Define a function:
def unique_non_null(s):
return s.dropna().unique()
Then use it in the aggregation:
df.groupby('b').agg({
'a': ['min', 'max', unique_non_null],
'c': ['first', 'last', unique_non_null]
})
Define a function:
def unique_non_null(s):
return s.dropna().unique()
Then use it in the aggregation:
df.groupby('b').agg({
'a': ['min', 'max', unique_non_null],
'c': ['first', 'last', unique_non_null]
})