Error when combining single row with multiple row CSV file into DataFrames

This is a pretty annoying error and I think the error message should be improved (or maybe the behaviour).

You can roughly guess from here:

[1] (::CSV.var"#3#4")(x::PooledArrays.PooledVector{String31, UInt32, Vector{UInt32}})
   @ CSV ./none:0

That it comes from PooledArrays. What’s happening here is that CSV is trying to stitch together one table from the two CSVs, but if it decides to pool the values in the first one this fails if there are additional values in the second table. In your case where you have only one row there’s only one value in it and the pool can’t capture the other values, while if you go the other way around the pool will have seen the whole range of values and can accomodate the additional value.

You can turn pooling off with the pool = false kwarg.

2 Likes