Answers for "dataframe groupby unique values"

3

pandas groupby column count distinct values

# Pandas group by a column looking at the count unique/count distinct values of another column

df.groupby('param')['group'].nunique()
Posted by: Guest on May-15-2020
0

group by 2 unique attributes pandas

import numpy as np
g = df.groupby('c')['l1','l2'].apply(lambda x: list(np.unique(x)))
Posted by: Guest on June-22-2021

Code answers related to "dataframe groupby unique values"

Python Answers by Framework

Browse Popular Code Answers by Language