Skip to content

Instantly share code, notes, and snippets.

@mrtushartiwari
Created September 29, 2022 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrtushartiwari/ff475e350d58fd3f21e9842050fd3051 to your computer and use it in GitHub Desktop.
Save mrtushartiwari/ff475e350d58fd3f21e9842050fd3051 to your computer and use it in GitHub Desktop.
splits large csv
import pandas as pd
FILE_PATH = 'WDISeries-Time.csv'
chunk_size = 50
parts_name = 'WDISeries-Time'
df = pd.read_csv(FILE_PATH,chunksize= chunk_size)
print(df, type(df))
for i,d in enumerate(df):
d.to_csv(f"{parts_name}_part_{i}.csv",index= False)
print(d.columns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment