Including the group name in the apply function pandas python
问题 Is there away to specify to the groupby() call to use the group name in the apply() lambda function? Similar to if I iterate through groups I can get the group key via the following tuple decomposition: for group_name, subdf in temp_dataframe.groupby(level=0, axis=0): print group_name ...is there a way to also get the group name in the apply function, such as: temp_dataframe.groupby(level=0,axis=0).apply(lambda group_name, subdf: foo(group_name, subdf) How can I get the group name as an