queryverse / CSVFiles.jl

FileIO.jl integration for CSV files
Other
51 stars 13 forks source link

Unable to load csv-file while CSV does not have a problem #44

Open johannspies opened 5 years ago

johannspies commented 5 years ago
using DataFrames, CSV, CSVFiles

d = CSV.read("/home/js/db_docs/programmatic_indicators/data/country-codes1.csv") |> DataFrame;
last(d,3)

    official_name_ar    official_name_cn    official_name_en    official_name_es    official_name_fr    official_name_ru    code    code_3  code_numeric    ISO4217_currency_alphabetic_code    ISO4217_currency_country_name   ISO4217_currency_minor_unit ISO4217_currency_name   ISO4217_currency_numeric_code   M49 UNTERM_Arabic_Formal    UNTERM_Arabic_Short UNTERM_Chinese_Formal   UNTERM_Chinese_Short    UNTERM_English_Formal   UNTERM_English_Short    UNTERM_French_Formal    UNTERM_French_Short UNTERM_Russian_Formal   UNTERM_Russian_Short    UNTERM_Spanish_Formal   UNTERM_Spanish_Short    CLDR_display_name   Capital Continent   DS  Developed_/_Developing_Countries    Dial    EDGAR   FIFA    FIPS    GAUL    Geoname_ID  Global_Code Global_Name IOC ITU Intermediate_Region_Code    Intermediate_Region_Name    Land_Locked_Developing_Countries__LLDC_ Languages   Least_Developed_Countries__LDC_ MARC    Region_Code Region_Name Small_Island_Developing_States__SIDS_   Sub_region_Code Sub_region_Name TLD WMO is_independent
String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ Int64⍰  String⍰ String⍰ String⍰ String⍰ String⍰ Int64⍰  String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ String⍰ Int64⍰  String⍰ String⍰ String⍰ String⍰ Int64⍰  String⍰ String⍰ String⍰ String⍰ String⍰ Int64⍰  String⍰ String⍰ Int64⍰  String⍰ String⍰ String⍰ String⍰
1   زامبيا  赞比亚 Zambia  Zambia  Zambie  Замбия  ZM  ZMB 894 ZMW ZAMBIA  2   Zambian Kwacha  967 894 جمهورية زامبيا  زامبيا  赞比亚共和国  赞比亚 the Republic of Zambia  Zambia  la République de Zambie Zambie (la) Республика Замбия   Замбия  la República de Zambia  Zambia  Zambia  Lusaka  AF  Z   Developing  260 Y4  ZAM ZA  270 895949  True    World   ZAM ZMB 14  Eastern Africa  x   en-ZM,bem,loz,lun,lue,ny,toi    x   za  2   Africa  missing 202 Sub-Saharan Africa  .zm ZB  Yes
2   زمبابوي 津巴布韦    Zimbabwe    Zimbabwe    Zimbabwe    Зимбабве    ZW  ZWE 716 ZWL ZIMBABWE    2   Zimbabwe Dollar 932 716 جمهورية زمبابوي زمبابوي 津巴布韦共和国 津巴布韦    the Republic of Zimbabwe    Zimbabwe    la République du Zimbabwe   Zimbabwe (le)   Республика Зимбабве Зимбабве    la República de Zimbabwe    Zimbabwe    Zimbabwe    Harare  AF  ZW  Developing  263 Y5  ZIM ZI  271 878675  True    World   ZIM ZWE 14  Eastern Africa  x   en-ZW,sn,nr,nd  missing rh  2   Africa  missing 202 Sub-Saharan Africa  .zw ZW  Yes
3   جزر ألاند   奥兰群岛    Åland Islands   Islas Åland Îles d'Åland    Аландские острова   AX  ALA 248 EUR ÅLAND ISLANDS   2   Euro    978 248 missing missing missing missing missing missing missing missing missing missing missing missing Åland Islands   Mariehamn   EU  FIN Developed   358 missing ALD missing 1242    661882  True    World   missing missing missing missing missing sv-AX   missing missing 150 Europe  missing 154 Northern Europe .ax missing Part of FI

With CSVFiles

 d = CSVFiles.load("/home/js/db_docs/programmatic_indicators/data/country-codes1.csv") |> DataFrame;
ERROR: StringIndexError("
Stacktrace:
 [1] string_index_err(::TextParse.VectorBackedUTF8String, ::Int64) at ./strings/string.jl:12
 [2] SubString{TextParse.VectorBackedUTF8String}(::TextParse.VectorBackedUTF8String, ::Int64, ::Int64) at ./strings/substring.jl:32
 [3] Type at ./strings/substring.jl:38 [inlined]
 [4] Type at ./strings/substring.jl:40 [inlined]
 [5] getindex at ./strings/substring.jl:191 [inlined]
 [6] showerrorchar(::TextParse.VectorBackedUTF8String, ::Int64, ::Int64) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:639
 [7] Type at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:613 [inlined]
 [8] parsefill!(::TextParse.VectorBackedUTF8String, ::TextParse.LocalOpts{UInt8,UInt8,UInt8}, ::TextParse.Record{Tuple{TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}}},Tuple{TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Int64,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,Union{Missing, Int64},Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Int64,Int64,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange}}, ::Int64, ::Tuple{Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Int64,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{Union{Missing, Int64},1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Int64,1},Array{Int64,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1}}, ::OrderedCollections.OrderedDict{Union{Int64, String},AbstractArray{T,1} where T}, ::Int64, ::Int64, ::Int64, ::Int64) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:543
 [9] #_csvread_internal#26(::Bool, ::Char, ::Char, ::Type, ::Type, ::Bool, ::Int64, ::Nothing, ::Nothing, ::Int64, ::Nothing, ::Bool, ::Array{String,1}, ::Array{String,1}, ::OrderedCollections.OrderedDict{Union{Int64, String},AbstractArray{T,1} where T}, ::Int64, ::Nothing, ::Array{Any,1}, ::String, ::Int64, ::typeof(TextParse._csvread_internal), ::TextParse.VectorBackedUTF8String, ::Char) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:320
 [10] (::getfield(TextParse, Symbol("#kw##_csvread_internal")))(::NamedTuple{(:filename, :stringarraytype),Tuple{String,UnionAll}}, ::typeof(TextParse._csvread_internal), ::TextParse.VectorBackedUTF8String, ::Char) at ./none:0
 [11] (::getfield(TextParse, Symbol("##22#24")){Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}},String,Char})(::IOStream) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:108
 [12] #open#294(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(TextParse, Symbol("##22#24")){Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}},String,Char}, ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
 [13] open at ./iostream.jl:367 [inlined]
 [14] #_csvread_f#20 at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:105 [inlined]
 [15] #_csvread_f at ./none:0 [inlined]
 [16] #csvread#16(::Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}}, ::Function, ::String, ::Char) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:76
 [17] (::getfield(TextParse, Symbol("#kw##csvread")))(::NamedTuple{(:stringarraytype,),Tuple{UnionAll}}, ::typeof(TextParse.csvread), ::String, ::Char) at ./none:0
 [18] _loaddata(::CSVFiles.CSVFile) at /home/js/.julia/packages/CSVFiles/KysmQ/src/CSVFiles.jl:83
 [19] get_columns_copy_using_missing(::CSVFiles.CSVFile) at /home/js/.julia/packages/CSVFiles/KysmQ/src/CSVFiles.jl:96
 [20] columns at /home/js/.julia/packages/Tables/8f4rT/src/fallbacks.jl:151 [inlined]
 [21] DataFrame(::CSVFiles.CSVFile) at /home/js/.julia/packages/DataFrames/IKMvt/src/other/tables.jl:21
 [22] |>(::CSVFiles.CSVFile, ::Type) at ./operators.jl:813
 [23] top-level scope at none:0SYSTEM: show(lasterr) caused an error
ErrorException("Not yet implemented.")

Stacktrace:
 [1] string_index_err(::TextParse.VectorBackedUTF8String, ::Int64) at ./strings/string.jl:12
 [2] SubString{TextParse.VectorBackedUTF8String}(::TextParse.VectorBackedUTF8String, ::Int64, ::Int64) at ./strings/substring.jl:32
 [3] Type at ./strings/substring.jl:38 [inlined]
 [4] Type at ./strings/substring.jl:40 [inlined]
 [5] getindex at ./strings/substring.jl:191 [inlined]
 [6] showerrorchar(::TextParse.VectorBackedUTF8String, ::Int64, ::Int64) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:639
 [7] Type at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:613 [inlined]
 [8] parsefill!(::TextParse.VectorBackedUTF8String, ::TextParse.LocalOpts{UInt8,UInt8,UInt8}, ::TextParse.Record{Tuple{TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{Int64,TextParse.Numeric{Int64}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}},TextParse.Field{TextParse.StrRange,TextParse.Quoted{TextParse.StrRange,TextParse.StringToken{TextParse.StrRange},UInt8,UInt8}}},Tuple{TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Int64,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,Union{Missing, Int64},Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Int64,Int64,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,Union{Missing, Int64},TextParse.StrRange,TextParse.StrRange,TextParse.StrRange,TextParse.StrRange}}, ::Int64, ::Tuple{Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Int64,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{Union{Missing, Int64},1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Int64,1},Array{Int64,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{Union{Missing, Int64},1},Array{String,1},Array{String,1},Array{String,1},Array{String,1}}, ::OrderedCollections.OrderedDict{Union{Int64, String},AbstractArray{T,1} where T}, ::Int64, ::Int64, ::Int64, ::Int64) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:543
 [9] #_csvread_internal#26(::Bool, ::Char, ::Char, ::Type, ::Type, ::Bool, ::Int64, ::Nothing, ::Nothing, ::Int64, ::Nothing, ::Bool, ::Array{String,1}, ::Array{String,1}, ::OrderedCollections.OrderedDict{Union{Int64, String},AbstractArray{T,1} where T}, ::Int64, ::Nothing, ::Array{Any,1}, ::String, ::Int64, ::typeof(TextParse._csvread_internal), ::TextParse.VectorBackedUTF8String, ::Char) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:320
 [10] (::getfield(TextParse, Symbol("#kw##_csvread_internal")))(::NamedTuple{(:filename, :stringarraytype),Tuple{String,UnionAll}}, ::typeof(TextParse._csvread_internal), ::TextParse.VectorBackedUTF8String, ::Char) at ./none:0
 [11] (::getfield(TextParse, Symbol("##22#24")){Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}},String,Char})(::IOStream) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:108
 [12] #open#294(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(TextParse, Symbol("##22#24")){Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}},String,Char}, ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
 [13] open at ./iostream.jl:367 [inlined]
 [14] #_csvread_f#20 at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:105 [inlined]
 [15] #_csvread_f at ./none:0 [inlined]
 [16] #csvread#16(::Base.Iterators.Pairs{Symbol,UnionAll,Tuple{Symbol},NamedTuple{(:stringarraytype,),Tuple{UnionAll}}}, ::Function, ::String, ::Char) at /home/js/.julia/packages/TextParse/HxeTz/src/csv.jl:76
 [17] (::getfield(TextParse, Symbol("#kw##csvread")))(::NamedTuple{(:stringarraytype,),Tuple{UnionAll}}, ::typeof(TextParse.csvread), ::String, ::Char) at ./none:0
 [18] _loaddata(::CSVFiles.CSVFile) at /home/js/.julia/packages/CSVFiles/KysmQ/src/CSVFiles.jl:83
 [19] get_columns_copy_using_missing(::CSVFiles.CSVFile) at /home/js/.julia/packages/CSVFiles/KysmQ/src/CSVFiles.jl:96
 [20] columns at /home/js/.julia/packages/Tables/8f4rT/src/fallbacks.jl:151 [inlined]
 [21] DataFrame(::CSVFiles.CSVFile) at /home/js/.julia/packages/DataFrames/IKMvt/src/other/tables.jl:21
 [22] |>(::CSVFiles.CSVFile, ::Type) at ./operators.jl:813
 [23] top-level scope at none:0
 [24] eval(::Module, ::Any) at ./boot.jl:319
 [25] eval_user_input(::Any, ::REPL.REPLBackend) at /build/julia-wJr69F/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
 [26] run_backend(::REPL.REPLBackend) at /home/js/.julia/packages/Revise/yp5KG/src/Revise.jl:769
 [27] (::getfield(Revise, Symbol("##58#60")){REPL.REPLBackend})() at ./task.jl:259
julia> 

If I truncate the file to the first 26 lines, CSVFiles reads it without a problem. Below the first 27 lines (that causes the problem) as an example of the data:

official_name_ar,official_name_cn,official_name_en,official_name_es,official_name_fr,official_name_ru,code,code_3,code_numeric,ISO4217_currency_alphabetic_code,ISO4217_currency_country_name,ISO4217_currency_minor_unit,ISO4217_currency_name,ISO4217_currency_numeric_code,M49,UNTERM_Arabic_Formal,UNTERM_Arabic_Short,UNTERM_Chinese_Formal,UNTERM_Chinese_Short,UNTERM_English_Formal,UNTERM_English_Short,UNTERM_French_Formal,UNTERM_French_Short,UNTERM_Russian_Formal,UNTERM_Russian_Short,UNTERM_Spanish_Formal,UNTERM_Spanish_Short,CLDR_display_name,Capital,Continent,DS,Developed_/_Developing_Countries,Dial,EDGAR,FIFA,FIPS,GAUL,Geoname_ID,Global_Code,Global_Name,IOC,ITU,Intermediate_Region_Code,Intermediate_Region_Name,Land_Locked_Developing_Countries__LLDC_,Languages,Least_Developed_Countries__LDC_,MARC,Region_Code,Region_Name,Small_Island_Developing_States__SIDS_,Sub_region_Code,Sub_region_Name,TLD,WMO,is_independent
,,"Taiwan, Republic of China ",,,,TW,TWN,158,,,,,,,,,,,,,,,,,,,Taiwan,Taipei,AS,RC,,886,,TPE,TW,925,1668284,,,TPE,,,,,"zh-TW,zh,nan,hak",,ch,,,,,,.tw,,Yes
أفغانستان,阿富汗,Afghanistan,Afganistán,Afghanistan,Афганистан,AF,AFG,4,AFN,AFGHANISTAN,2,Afghani,971,4,جمهورية أفغانستان الإسلامية,أفغانستان,阿富汗伊斯兰共和国,阿富汗,the Islamic Republic of Afghanistan,Afghanistan,République islamique d'Afghanistan,Afghanistan (l') [masc.],Исламская Республика Афганистан,Афганистан,República Islámica del Afganistán (la),Afganistán (el),Afghanistan,Kabul,AS,AFG,Developing,93,B2,AFG,AF,1,1149361,True,World,AFG,AFG,,,x,"fa-AF,ps,uz-AF,tk",x,af,142,Asia,,34,Southern Asia,.af,AF,Yes
ألبانيا,阿尔巴尼亚,Albania,Albania,Albanie,Албания,AL,ALB,8,ALL,ALBANIA,2,Lek,8,8,جمهورية ألبانيا,ألبانيا,阿尔巴尼亚共和国,阿尔巴尼亚,the Republic of Albania,Albania,la République d'Albanie,Albanie (l') [fém.],Республика Албания,Албания,la República de Albania,Albania,Albania,Tirana,EU,AL,Developed,355,B3,ALB,AL,3,783754,True,World,ALB,ALB,,,,"sq,el",,aa,150,Europe,,39,Southern Europe,.al,AB,Yes
الجزائر,阿尔及利亚,Algeria,Argelia,Algérie,Алжир,DZ,DZA,12,DZD,ALGERIA,2,Algerian Dinar,12,12,الجمهورية الجزائرية الديمقراطية الشعبية,الجزائر,阿尔及利亚民主人民共和国,阿尔及利亚,the People's Democratic Republic of Algeria,Algeria,la République algérienne démocratique et populaire,Algérie (l') [fém.],Алжирская Народная Демократическая Республика,Алжир,la República Argelina Democrática y Popular,Argelia,Algeria,Algiers,AF,DZ,Developing,213,B4,ALG,AG,4,2589581,True,World,ALG,ALG,,,,ar-DZ,,ae,2,Africa,,15,Northern Africa,.dz,AL,Yes
ساموا الأمريكية,美属萨摩亚,American Samoa,Samoa Americana,Samoa américaines,Американское Самоа,AS,ASM,16,USD,AMERICAN SAMOA,2,US Dollar,840,16,,,,,,,,,,,,,American Samoa,Pago Pago,OC,USA,Developing,1-684,B5,ASA,AQ,5,5880801,True,World,ASA,SMA,,,,"en-AS,sm,to",,as,9,Oceania,x,61,Polynesia,.as,,Territory of US
أندورا,安道尔,Andorra,Andorra,Andorre,Андорра,AD,AND,20,EUR,ANDORRA,2,Euro,978,20,إمارة أندورا,أندورا,安道尔公国,安道尔,the Principality of Andorra,Andorra,la Principauté d'Andorre,Andorre (l') [fém.],Княжество Андорра,Андорра,el Principado de Andorra,Andorra,Andorra,Andorra la Vella,EU,AND,Developed,376,B6,AND,AN,7,3041565,True,World,AND,AND,,,,ca,,an,150,Europe,,39,Southern Europe,.ad,,Yes
أنغولا,安哥拉,Angola,Angola,Angola,Ангола,AO,AGO,24,AOA,ANGOLA,2,Kwanza,973,24,جمهورية أنغولا,أنغولا,安哥拉共和国,安哥拉,the Republic of Angola,Angola,la République d'Angola,Angola (l') [masc.],Республика Ангола,Ангола,la República de Angola,Angola,Angola,Luanda,AF,AO,Developing,244,B7,ANG,AO,8,3351879,True,World,ANG,AGL,17,Middle Africa,,pt-AO,x,ao,2,Africa,,202,Sub-Saharan Africa,.ao,AN,Yes
أنغيلا,安圭拉,Anguilla,Anguila,Anguilla,Ангилья,AI,AIA,660,XCD,ANGUILLA,2,East Caribbean Dollar,951,660,,,,,,,,,,,,,Anguilla,The Valley,NA,,Developing,1-264,1A,AIA,AV,9,3573511,True,World,AIA,AIA,29,Caribbean,,en-AI,,am,19,Americas,x,419,Latin America and the Caribbean,.ai,,Territory of GB
أنتاركتيكا,南极洲,Antarctica,Antártida,Antarctique,Антарктике,AQ,ATA,10,,ANTARCTICA,,No universal currency,,10,,,,,,,,,,,,,Antarctica,,AN,,,672,B8,ROS,AY,10,6697173,True,World,,,,,,,,ay,,,,,,.aq,AA,International
أنتيغوا وبربودا,安提瓜和巴布达,Antigua and Barbuda,Antigua y Barbuda,Antigua-et-Barbuda,Антигуа и Барбуда,AG,ATG,28,XCD,ANTIGUA AND BARBUDA,2,East Caribbean Dollar,951,28,أنتيغوا وبربودا,أنتيغوا وبربودا,安提瓜和巴布达,安提瓜和巴布达,Antigua and Barbuda,Antigua and Barbuda,Antigua-et-Barbuda [fém.],Antigua-et-Barbuda [fém.],Антигуа и Барбуда,Антигуа и Барбуда,Antigua y Barbuda,Antigua y Barbuda,Antigua & Barbuda,St. John's,NA,,Developing,1-268,B9,ATG,AC,11,3576396,True,World,ANT,ATG,29,Caribbean,,en-AG,,aq,19,Americas,x,419,Latin America and the Caribbean,.ag,AT,Yes
الأرجنتين,阿根廷,Argentina,Argentina,Argentine,Аргентина,AR,ARG,32,ARS,ARGENTINA,2,Argentine Peso,32,32,جمهورية الأرجنتين,الأرجنتين,阿根廷共和国,阿根廷,the Argentine Republic,Argentina,la République argentine,Argentine (l') [fém.],Аргентинская Республика,Аргентина,la República Argentina,Argentina (la),Argentina,Buenos Aires,SA,RA,Developing,54,C1,ARG,AR,12,3865483,True,World,ARG,ARG,5,South America,,"es-AR,en,it,de,fr,gn",,ag,19,Americas,,419,Latin America and the Caribbean,.ar,AG,Yes
أرمينيا,亚美尼亚,Armenia,Armenia,Arménie,Армения,AM,ARM,51,AMD,ARMENIA,2,Armenian Dram,51,51,جمهورية أرمينيا,أرمينيا,亚美尼亚共和国,亚美尼亚,the Republic of Armenia,Armenia,la République d'Arménie,Arménie (l') [fém.],Республика Армения,Армения,la República de Armenia,Armenia,Armenia,Yerevan,AS,AM,Developing,374,1B,ARM,AM,13,174982,True,World,ARM,ARM,,,x,hy,,ai,142,Asia,,145,Western Asia,.am,AY,Yes
أروبا,阿鲁巴,Aruba,Aruba,Aruba,Аруба,AW,ABW,533,AWG,ARUBA,2,Aruban Florin,533,533,,,,,,,,,,,,,Aruba,Oranjestad,NA,AW,Developing,297,1C,ARU,AA,14,3577279,True,World,ARU,ABW,29,Caribbean,,"nl-AW,es,en",,aw,19,Americas,x,419,Latin America and the Caribbean,.aw,NU,Part of NL
أستراليا,澳大利亚,Australia,Australia,Australie,Австралия,AU,AUS,36,AUD,AUSTRALIA,2,Australian Dollar,36,36,أستراليا,أستراليا,澳大利亚,澳大利亚,Australia,Australia,l'Australie,Australie (l') [fém.],Австралия,Австралия,Australia,Australia,Australia,Canberra,OC,AUS,Developed,61,C3,AUS,AS,17,2077456,True,World,AUS,AUS,,,,en-AU,,at,9,Oceania,,53,Australia and New Zealand,.au,AU,Yes
النمسا,奥地利,Austria,Austria,Autriche,Австрия,AT,AUT,40,EUR,AUSTRIA,2,Euro,978,40,جمهورية النمسا,النمسا,奥地利共和国,奥地利,the Republic of Austria,Austria,la République d'Autriche,Autriche (l') [fém.],Австрийская Республика,Австрия,la República de Austria,Austria,Austria,Vienna,EU,A,Developed,43,C4,AUT,AU,18,2782113,True,World,AUT,AUT,,,,"de-AT,hr,hu,sl",,au,150,Europe,,155,Western Europe,.at,OS,Yes
أذربيجان,阿塞拜疆,Azerbaijan,Azerbaiyán,Azerbaïdjan,Азербайджан,AZ,AZE,31,AZN,AZERBAIJAN,2,Azerbaijan Manat,944,31,جمهورية أذربيجان,أذربيجان,阿塞拜疆共和国,阿塞拜疆,the Republic of Azerbaijan,Azerbaijan,la République d'Azerbaïdjan,Azerbaïdjan (l') [masc.],Азербайджанская Республика,Азербайджан,la República de Azerbaiyán,Azerbaiyán,Azerbaijan,Baku,AS,AZ,Developing,994,1D,AZE,AJ,19,587116,True,World,AZE,AZE,,,x,"az,ru,hy",,aj,142,Asia,,145,Western Asia,.az,AJ,Yes
جزر البهاما,巴哈马,Bahamas,Bahamas,Bahamas,Багамские Острова,BS,BHS,44,BSD,BAHAMAS,2,Bahamian Dollar,44,44,كمنولث جزر البهاما,جزر البهاما,巴哈马国,巴哈马,the Commonwealth of the Bahamas,Bahamas (the),le Commonwealth des Bahamas,Bahamas (les) [fém.],Содружество Багамских Островов,Багамские Острова,el Commonwealth de las Bahamas,Bahamas (las),Bahamas,Nassau,NA,BS,Developing,1-242,C5,BAH,BF,20,3572887,True,World,BAH,BAH,29,Caribbean,,en-BS,,bf,19,Americas,x,419,Latin America and the Caribbean,.bs,BA,Yes
البحرين,巴林,Bahrain,Bahrein,Bahreïn,Бахрейн,BH,BHR,48,BHD,BAHRAIN,3,Bahraini Dinar,48,48,مملكة البحرين,البحرين,巴林王国,巴林,the Kingdom of Bahrain,Bahrain,le Royaume de Bahreïn,Bahreïn [masc.],Королевство Бахрейн,Бахрейн,el Reino de Bahrein,Bahrein,Bahrain,Manama,AS,BRN,Developing,973,C6,BHR,BA,21,290291,True,World,BRN,BHR,,,,"ar-BH,en,fa,ur",,ba,142,Asia,,145,Western Asia,.bh,BN,Yes
بنغلاديش,孟加拉国,Bangladesh,Bangladesh,Bangladesh,Бангладеш,BD,BGD,50,BDT,BANGLADESH,2,Taka,50,50,جمهورية بنغلاديش الشعبية,بنغلاديش,孟加拉人民共和国,孟加拉国,the People's Republic of Bangladesh,Bangladesh,la République populaire du Bangladesh,Bangladesh (le),Народная Республика Бангладеш,Бангладеш,la República Popular de Bangladesh,Bangladesh,Bangladesh,Dhaka,AS,BD,Developing,880,C7,BAN,BG,23,1210997,True,World,BAN,BGD,,,,"bn-BD,en",x,bg,142,Asia,,34,Southern Asia,.bd,BW,Yes
بربادوس,巴巴多斯,Barbados,Barbados,Barbade,Барбадос,BB,BRB,52,BBD,BARBADOS,2,Barbados Dollar,52,52,بربادوس,بربادوس,巴巴多斯,巴巴多斯,Barbados,Barbados,la Barbade,Barbade (la),Барбадос,Барбадос,Barbados,Barbados,Barbados,Bridgetown,NA,BDS,Developing,1-246,C8,BRB,BB,24,3374084,True,World,BAR,BRB,29,Caribbean,,en-BB,,bb,19,Americas,x,419,Latin America and the Caribbean,.bb,BR,Yes
بيلاروس,白俄罗斯,Belarus,Belarús,Bélarus,Беларусь,BY,BLR,112,BYN,BELARUS,2,Belarusian Ruble,933,112,جمهورية بيلاروس,بيلاروس,白俄罗斯共和国,白俄罗斯,the Republic of Belarus,Belarus,la République du Bélarus,Bélarus (le),Республика Беларусь,Беларусь,la República de Belarús,Belarús,Belarus,Minsk,EU,BY,Developed,375,1F,BLR,BO,26,630336,True,World,BLR,BLR,,,,"be,ru",,bw,150,Europe,,151,Eastern Europe,.by,BY,Yes
بلجيكا,比利时,Belgium,Bélgica,Belgique,Бельгия,BE,BEL,56,EUR,BELGIUM,2,Euro,978,56,مملكة بلجيكا,بلجيكا,比利时王国,比利时,the Kingdom of Belgium,Belgium,le Royaume de Belgique,Belgique (la),Королевство Бельгия,Бельгия,el Reino de Bélgica,Bélgica,Belgium,Brussels,EU,B,Developed,32,C9,BEL,BE,27,2802361,True,World,BEL,BEL,,,,"nl-BE,fr-BE,de-BE",,be,150,Europe,,155,Western Europe,.be,BX,Yes
بليز,伯利兹,Belize,Belice,Belize,Белиз,BZ,BLZ,84,BZD,BELIZE,2,Belize Dollar,84,84,بليز,بليز,伯利兹,伯利兹,Belize,Belize,le Belize,Belize (le),Белиз,Белиз,Belice,Belice,Belize,Belmopan,NA,BH,Developing,501,D1,BLZ,BH,28,3582678,True,World,BIZ,BLZ,13,Central America,,"en-BZ,es",,bh,19,Americas,x,419,Latin America and the Caribbean,.bz,BH,Yes
بنن,贝宁,Benin,Benin,Bénin,Бенин,BJ,BEN,204,XOF,BENIN,0,CFA Franc BCEAO,952,204,جمهورية بنن,بنن,贝宁共和国,贝宁,the Republic of Benin,Benin,la République du Bénin,Bénin (le),Республика Бенин,Бенин,la República de Benin,Benin,Benin,Porto-Novo,AF,DY,Developing,229,G6,BEN,BN,29,2395170,True,World,BEN,BEN,11,Western Africa,,fr-BJ,x,dm,2,Africa,,202,Sub-Saharan Africa,.bj,BJ,Yes
برمودا,百慕大,Bermuda,Bermuda,Bermudes,Бермудские острова,BM,BMU,60,BMD,BERMUDA,2,Bermudian Dollar,60,60,,,,,,,,,,,,,Bermuda,Hamilton,NA,BM,Developed,1-441,D0,BER,BD,30,3573345,True,World,BER,BER,,,,"en-BM,pt",,bm,19,Americas,,21,Northern America,.bm,BE,Territory of GB
بوتان,不丹,Bhutan,Bhután,Bhoutan,Бутан,BT,BTN,64,"INR,BTN",BHUTAN,"2,2","Indian Rupee,Ngultrum","356,064",64,مملكة بوتان,بوتان,不丹王国,不丹,the Kingdom of Bhutan,Bhutan,le Royaume du Bhoutan,Bhoutan (le),Королевство Бутан,Бутан,el Reino de Bhután,Bhután,Bhutan,Thimphu,AS,BT,Developing,975,D2,BHU,BT,31,1252634,True,World,BHU,BTN,,,x,dz,x,bt,142,Asia,,34,Southern Asia,.bt,,Yes
davidanthoff commented 5 years ago

This was a very interesting bug! The bug here is that this uncovered a whole bunch of problems that come up in the diagnostic display if parsing fails. I think I fixed all of them in https://github.com/JuliaComputing/TextParse.jl/pull/114. With that PR, things still don't work, but one gets a slightly more helpful error message:

julia> load("test.csv") |> DataFrame
MethodError: Cannot `convert` an object of type Missing to an object of type TextParse.StrRange
Closest candidates are:
  convert(::Type{S}, ::T<:(Union{CategoricalString{R}, CategoricalValue{T,R} where T} where R)) where {S, T<:(Union{CategoricalString{R}, CategoricalValue{T,R} where T} where R)} at C:\Users\david\.julia\packages\CategoricalArrays\ucKV2\src\value.jl:91
  convert(::Type{T}, ::T) where T at essentials.jl:154
  TextParse.StrRange(::Any, ::Any) at C:\Users\david\.julia\dev\TextParse\src\util.jl:317
ERROR: CSV parsing error in test.csv at line 29 char 79:
...án,Bhoutan,Бутан,BT,BTN,64,"INR,BTN",BHUTAN,"2,2","Indian Rupee,Ngultrum","356,064",64,مملك...
____________________________________________________^
column 12 is expected to be: TextParse.Field{Union{Missing, Int64},TextParse.NAToken{Union{Missing, Int64},TextParse.Numeric{Int64}}}(<Int64>?, true, true, false)

What is happening here is that the type detection algorithm classifies column 12 (and I believe 14 as well) as Int, but then line 26 has a string value for that column. We currently cannot recover from a situation where a column as originally classified as Int and then turns out to be String halfway through the parsing.

Two options to solve this for now: 1) you can manually specify that these columns should be parsed as String, by doing load(filename, colparsers=Dict(12=>String, 14=>String)). Or you can simply increase the number of rows that should be used for column type detection slightly to something larger than 20 (the default): load(filename, type_detect_rows=30) should do the trick.

I do have a plan to make this more robust in general, i.e. a way to recover if the type detection fails (which can always happen, even if one samples more lines), but it will be a while until that is done.

And this file also highlights that our default table printing code all messes up the width when there is some serious unicode there :)

EricForgy commented 5 years ago

Hi @johannspies 👋

Coincidentally, I ran into the same issue with the same data set 😅

Since we were looking at the same data set, I thought I'd let you know I just created these two repos:

based off this data set 😊

A bit of explanation and request for feedback can be found here https://github.com/JuliaFinance/Roadmap/issues/5

Cheers 😊