What do you want to save?
Add Code snippet
New code examples
-
Python 2021-08-29 00:56:01
find sum of values in a column that corresponds to unique vallues in another coulmn python
group = df.groupby('author') df2 = group.apply(lambda x: x['subreddit'].unique()) # Alternatively, same thing as a one liner: # df2 = df.groupby('author').apply(lambda x: x['subreddit'].unique()) Add solution