Hi! I am combining several .csv
files into DataFrames. Each file has uniform column numbers and data types. Everything works but when I try to combine a .csv
file that contains a single row with one that contains multiple rows I get the following error.
CSV.read(["singlerowfilepath","multiplerowfilepath"], DataFrame)
returns
ERROR: UndefVarError: `A` not defined
Stacktrace:
[1] (::CSV.var"#3#4")(x::PooledArrays.PooledVector{String31, UInt32, Vector{UInt32}})
@ CSV ./none:0
[2] iterate
@ ./generator.jl:47 [inlined]
[3] collect(itr::Base.Generator{Vector{PooledArrays.PooledVector{String31, UInt32, Vector{UInt32}}}, CSV.var"#3#4"})
@ Base ./array.jl:834
[4] chaincolumns!(a::Any, b::Any)
@ CSV ~/.julia/packages/CSV/tmZyn/src/utils.jl:240
[5] CSV.File(sources::Vector{String}; source::Nothing, kw::@Kwargs{})
@ CSV ~/.julia/packages/CSV/tmZyn/src/file.jl:930
[6] File
@ ~/.julia/packages/CSV/tmZyn/src/file.jl:901 [inlined]
[7] read(source::Vector{String}, sink::Type; copycols::Bool, kwargs::@Kwargs{})
@ CSV ~/.julia/packages/CSV/tmZyn/src/CSV.jl:117
[8] read(source::Vector{String}, sink::Type)
@ CSV ~/.julia/packages/CSV/tmZyn/src/CSV.jl:113
[9] top-level scope
@ REPL[134]:1
and
DataFrame!(CSV.File(["singlerowfilepath","multiplerowfilepath"]))
or
DataFrame(CSV.File(["singlerowfilepath","multiplerowfilepath"]))
each return
ERROR: UndefVarError: `A` not defined
Stacktrace:
[1] (::CSV.var"#3#4")(x::PooledArrays.PooledVector{String31, UInt32, Vector{UInt32}})
@ CSV ./none:0
[2] iterate
@ ./generator.jl:47 [inlined]
[3] collect(itr::Base.Generator{Vector{PooledArrays.PooledVector{String31, UInt32, Vector{UInt32}}}, CSV.var"#3#4"})
@ Base ./array.jl:834
[4] chaincolumns!(a::Any, b::Any)
@ CSV ~/.julia/packages/CSV/tmZyn/src/utils.jl:240
[5] CSV.File(sources::Vector{String}; source::Nothing, kw::@Kwargs{})
@ CSV ~/.julia/packages/CSV/tmZyn/src/file.jl:930
[6] CSV.File(sources::Vector{String})
@ CSV ~/.julia/packages/CSV/tmZyn/src/file.jl:901
[7] top-level scope
@ REPL[138]:1
Whereas reversing the order of the files i.e.
CSV.read(["multiplerowfilepath","singlerowfilepath"], DataFrame)
returns a Dataframe with uniform column number and data type.
Just wondering if anyone had any insight on why this is happening and what I might do to fix it without having to worry about the order of the files. Thanks!