df = pd.DataFrame({'node': [1, 2, 3, 3, 3, 5, 5], 'lang': ['it', 'en', 'ar',
    'ar', 'es', 'uz', 'es']})
a = df.groupby('node')['lang'].unique().reset_index(name='langs')
pandas - create dataframe with counts and frequency of elements