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