I have a table in pandas/python and I am doing the following:
grouped_data = df_comments_cols['article_id'].groupby(df_comments_cols['user_id'])
Now to count the number of articles per user I do the following:
ct_grouped_data = grouped_data.count()
The above counts the number of article IDs per user. However, sometimes there are multiple of the same article IDs per user (in the sense that a user has interacted with that article more than once) and I only wish to count unique article IDs per user - is there a quick way to do this?
Thanks in advance.