I'm wanting to create separate dataframes taken from a csv file, and each row with the same ID to a new dataframe (or csv file)... the list of IDs would be unknown unless I open the csv file which contains thousands of IDs... I don't necessarily need separate dataframes for each ID but I do need separate csv files for each ID... the csv could be named after the batch and saved in the same file path as the df1 source.
df1source: ID A B 0 B345 male 12 1 B980 female 34 2 B980 female 44 3 B345 female 04 4 B456 male 78
import pandas as pd
df1 = pd.read_csv(r"C:file\path\df1source.csv")
desired output:
df2 = ID A B 0 B345 male 12 1 B345 female 04
df3 = ID A B 0 B980 female 34 1 B980 female 44
df4 = ID A B 0 B456 male 78