Hello! I’m having a bit of trouble with being able to edit a DataFrame after reading them in from a CSV. I’ve set it up as shown below.
julia> df = DataFrame(A = String[], B = Int[])
0×2 DataFrame
julia> CSV.write("test.csv", df)
"test.csv"
julia> df2 = DataFrame(CSV.File("test.csv"))
0×2 DataFrame
However, if I try to push! a row into this DataFrame, I get this.
julia> push!(df2, ("hello", 5))
┌ Error: Error adding value to column :A.
└ @ DataFrames C:\Users\xxxxx\.julia\packages\DataFrames\oQ5c7\src\dataframe\dataframe.jl:1532
ERROR: StackOverflowError:
Stacktrace:
[1] push!(::SentinelArrays.MissingVector, ::String) at .\array.jl:982
[2] append! at C:\Users\xxxxx\.julia\packages\SentinelArrays\Ubf17\src\missingvector.jl:109 [inlined]
... (the last 2 lines are repeated 52190 more times)
[104383] push!(::SentinelArrays.MissingVector, ::String) at .\array.jl:982
[104384] push!(::DataFrame, ::Tuple{String,Int64}; promote::Bool) at C:\Users\xxxxx\.julia\packages\DataFrames\oQ5c7\src\dataframe\dataframe.jl:1514
[104385] push!(::DataFrame, ::Tuple{String,Int64}) at C:\Users\xxxxx\.julia\packages\DataFrames\oQ5c7\src\dataframe\dataframe.jl:1494
Is there an alternative to get around this error? I know that some usages of CSV tend to return an immutable DataFrame, but I’m unsure of how to make it mutable. I’m using DataFrames v0.22.5.
Any help appreciated!