I have data of the following form:
df = pd.DataFrame({ \'group\': [1, 1, 2, 3, 3, 3, 4], \'param\': [\'a\', \'a\', \'b\', np.nan, \'a\', \'a\', np.na
This is just an add-on to the solution in case you want to compute not only unique values but other aggregate functions:
df.groupby(['group']).agg(['min','max','count','nunique'])
Hope you find it useful