I have a dataframe that I need to subset by the column measure name. Measure_Group=measures.groupby('Measure'). I can get.group() like this CDC=Measure_Group.get_group('CDC') , but I have over 20 measures to subset. Is there a for loop or lambda function that I can use with the group by to subset all 20 column names with just one iteration instead of using the get.group multiple times
Asked
Active
Viewed 38 times
0
-
Does this answer your question? [Split pandas dataframe based on groupby](https://stackoverflow.com/questions/23691133/split-pandas-dataframe-based-on-groupby) – AlexK Apr 17 '21 at 00:50
-
`measures[measures['Measure'].isin(list_of_20_measures)]`. – Quang Hoang Apr 17 '21 at 00:53