I have a dataframe saved in a list. Is there a way to loop through the list to create separate dataframes based of a column value?
ex: Turn this
df
ID | Colour | Transport |
---|---|---|
0902 | red | car |
0902 | blue | car |
0105 | red | car |
0105 | yellow | car |
0105 | orange | boat |
To this:
df1
ID | Colour | Transport |
---|---|---|
0902 | red | car |
0902 | blue | car |
df2
ID | Colour | Transport |
---|---|---|
0105 | red | car |
0105 | yellow | car |
0105 | orange | boat |
I have searched for a way to do this but can't find it. Any ideas?