I am trying to split the data frame based on a column value. In my example, one column in the dataframe is “region”. This is what I found from the manual online:
Suppose that we have 5 possible values for regions:
len(df["region"].unique()) >> 5
Therefore I expect 5 pandas dataframes from the output. How may I access all the 5 pandas dataframes?
Maybe a more general question is – is there any way to find “how to access all the 5 dataframe” from the following codes? I see a big black box but do not know a way to open it
df.groupby("region") >> <pandas.core.groupby.generic.DataFrameGroupBy object at 0x000001C948EE2BE0>