Reputation: 3774
I am having real fun with groupby function in pandas, please advice on how to apply functions on groupby? Such as, I want to know how many rows grouped by track_id satisfies the rule_1==4
or anything in general.
df.groupby('track_id')['rule_1'].count()
I want to know rule_1 which equals some value.
I tried this -
df.groupby('track_id')['rule_1'==4].count()
Is there a callback function or anything simpler ?
Upvotes: 1
Views: 33