[BUG] handle } in line delimited json by joshowen · Pull Request #14391 · pandas-dev/pandas (original) (raw)

you can run asv if you want, otherwise just do it in ipython (before and after), e.g. something like

In [6]: df = DataFrame(dict([('float{0}'.format(i), np.random.randn(N)) for i in range(C)]), index=index).reset_index(drop=True)

In [7]: df.to_json('foo.json',orient='records',lines=True)

In [8]: %timeit df.to_json('foo.json',orient='records',lines=True)
1 loop, best of 3: 3.66 s per loop

In [9]: %timeit df.to_json('foo.json',orient='records')
10 loops, best of 3: 98.8 ms per loop

and looking at this, we have a BIG perf hit when lines=True (this is a separate issue).