first post here for me (I've been googling all day and couldn't find anything), be gentle please.
so I am working with a dataframe with multiple columns, some floats, some booleans.
col_1 col_2 col_3 col_4 col_5 col_6
0 38.109375 37.515625 True False (64, 69) F
1 27.265625 28.484375 True False (74, 79) M
2 26.843750 27.015625 False True (64, 69) F
I want to re-order/make a new df which:
- is groupby col_6 AND col_5 (check)
- has the mean values of col_1 and col_2 (check)
- counts 'True' in col_3 and col_4 (doesn't work)
my approach so far:
new_df = df.groupby(['col_6', 'col_5']).agg({'col_5' : ['count'], 'col_1' : ['mean'], 'col_2' : ['mean']})
but I could not figure out how can I count the "trues" also related to col_5 and col_6? hope this makes sense and someone might help.