I have a data frame that has thousands of rows in a Jupyter Notebook using Pandas. I am attempting to use a particular column in this data frame to split the df into multiple dfs based on the columns values. If there is a way to do this without specifying the different values in the column explicitly, that would be great.
| Col1 | Col2 | Col3 | Col4 |
|---|---|---|---|
| dat1 | Val1 | etc1 | set1 |
| dat2 | Val2 | etc2 | set2 |
| dat3 | Val3 | etc3 | set2 |
| dat4 | Val4 | etc4 | set3 |
An example of one of the variations of my code:
NAM_df2 = NAM_df1.loc[NAM_df1["Col4"] == 'set2']