Writing large Pandas Dataframes to CSV file in chunks

前端 未结 3 449
无人共我
无人共我 2020-12-01 08:39

How do I write out a large data file to a CSV file in chunks?

I have a set of large data files (1M rows x 20 cols). However, only 5 or so columns of that data is of

3条回答
  •  情深已故
    2020-12-01 09:06

    Check out the chunksize argument in the to_csv method. Here are the docs.

    Writing to file would look like:

    df.to_csv("path/to/save/file.csv", chunksize=1000, cols=['TIME','STUFF'])
    

提交回复
热议问题