Created
February 26, 2020 04:23
-
-
Save databyjp/0e44ace921b97ec2041538e5111470e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> travel_cats = ['home', 'travelled', 'rest_cats'] | |
... travel_grp_df = box_df.groupby(travel_cats).sum() | |
... travel_grp_df = travel_grp_df.assign(games=box_df.groupby(travel_cats)['minutes_played'].count()) | |
... travel_grp_df.reset_index(drop=False, inplace=True) | |
... print(travel_grp_df[travel_cats + ['games']]) | |
home travelled rest_cats games | |
0 False False 2+ Days 15 | |
1 False True 0 Days 246 | |
2 False True 1 Days 717 | |
3 False True 2+ Days 252 | |
4 True False 0 Days 57 | |
5 True False 1 Days 442 | |
6 True False 2+ Days 161 | |
7 True True 0 Days 95 | |
8 True True 1 Days 331 | |
9 True True 2+ Days 144 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment