How can I split a large csv with many columns, based on changing one column e.g ID? here is an example:
import pandas as pd
from pandas.compat import StringIO
csvdata = StringIO("""ID,f1
1,3.2
1,4.3
1,10
7,9.1
7,2.3
7,4.4
""")
df = pd.read_csv(csvdata, sep=",")
df
My aim is to save each block in separate csv which its name is generated in a loop based on ID:
df_ID_1.csv
ID f1
1 3.2
1 4.3
1 10.0
df_ID_7.csv
ID f1
7 9.1
7 2.3
7 4.4
Thank you very much!
