PERF: json should process data column-by-column (and not use .values) · Issue #9037 · pandas-dev/pandas (original) (raw)
xref #9027
So to_json
first converts all the a DataFrame by using .values
. This converts everything to object dtype (if its a mixed frame) and is pretty expensive perf wise.
If you do this column by column you get excellent perf (and tiny bit more complexity in the code).