I have a data frame where the rows represent a transaction done by a certain user. Note that more than one row can have the same user_id. Given the column names gender and user_id running:
df.gender.value_counts()
returns the frequencies but they are spurious since they may be possibly counting a given user more than once. So for example, it may tell me there are 50 male individuals while they are actually much less.
Is there a way I can condition value_counts()
to count only once per user_id?