Starting from this dataframe df:
df = pd.DataFrame({\'c\':[1,1,1,2,2,2],\'l1\':[\'a\',\'a\',\'b\',\'c\',\'c\',\'b\'],\'l2\':[\'b\',\'d\',\'d\',\'f\',\'e\',\'f\']
You can do it with apply:
apply
import numpy as np g = df.groupby('c')['l1','l2'].apply(lambda x: list(np.unique(x)))
Alternatively, you can use agg:
agg
g = df.groupby('c')['l1','l2'].agg(['unique'])