group by pandas to list code example Example: group by pandas to list df.groupby('a')['b'].apply(list)