Comparing length of json-encoded DataFrame. to_json doc
Conclusions with my sample dataset
CSV
- can be signifantly more compact if your data has lots of
nan
s / strings, since their encoding is empty / not-quoted - but index is lost
- and careful with incompatible quoting if you embed csv in json
- can be signifantly more compact if your data has lots of
split
is the most compactjson
encoding that keeps column and index names, use it overcolumns
(default) /record
- but index name is lost
- and MultiIndex does not wround-trip