I have this data frame.
City Name
0 Seattle Alice
1 Seattle Bob
2 Portland Mallory
3 Seattle Mallory
4 Seattle Bob
5 Portland Mallory
I need to split the dataframe based on city. So I need a seperate Seattle and Portland dataframe.
g = df.groupby( [ "City"] )
I can group by city but I need to get individual data frames for Seattle and Portland. I don't want to apply any aggregate function to the dataframe just yet.
Dataframe for Seattle
City Name
0 Seattle Alice
1 Seattle Bob
3 Seattle Mallory
4 Seattle Bob
Dataframe for Portland
City Name
2 Portland Mallory
5 Portland Mallory