for i, chunk in enumerate(pd.read_csv(csv_file, chunksize=1000000)): chunk.to_csv('ACTIVITY_EMAIL_OPEN_{}.csv'.format(i), index=False)
Here is what the above code is Doing:
1. We’re reading the CSV file in chunks of 1 million rows.
2. We’re writing each chunk to a separate CSV file.
3. We’re naming each file with a number that corresponds to the chunk number.