What is the fastest way to output large DataFrame into a CSV file?

前端 未结 4 1416
北海茫月
北海茫月 2020-12-01 14:19

For python / pandas I find that df.to_csv(fname) works at a speed of ~1 mln rows per min. I can sometimes improve performance by a factor of 7 like this:

def         


        
4条回答
  •  一生所求
    2020-12-01 14:33

    use chunksize. I have found that makes a hell lot of difference. If you have memory in hand use good chunksize (no of rows) to get into memory and then write once.

提交回复
热议问题