Reputation:
Dataframe is below
user_id
1236
5842
1236
My out
user_id count
1236 2
5842 1
result = df.groupby(['user_id']).count()
not working
Upvotes: 1
Views: 40
Reputation: 14124
Explicit
df.groupby(['user_id']).agg({'user_id': 'count'})
user_id
user_id
1236 2
5842 1
Upvotes: 2