JSON3.jl icon indicating copy to clipboard operation
JSON3.jl copied to clipboard

DataFrameRows iterator (from DataFrames.eachrow) repeats entire dataframe when serialising with JSON3

Open ahjulstad opened this issue 9 months ago • 0 comments

Example:

using JSON3, DataFrames

rc = 1000
df = DataFrame(a=1:rc, b=rand('a':'z', rc), c=rand(rc))

println(length(JSON3.write(df)))
println(length(JSON3.write(eachrow(df))))

prints

27327   
27426787

I stumbled upon this trying a naïve approach for outputing the dataframe in record mode. The easiest workaround for me was to use TypedTables and just make a Table out if the dataframe first (instead of creating an iterator).

ahjulstad avatar May 14 '24 04:05 ahjulstad