one two data data key key - two of courseyou can choose to do whatever you want with the pieces of data recipe you may find useful is computing dict of the data pieces as one-linerin [ ]pieces dict(list(df groupby('key '))in [ ]pieces[' 'out[ ]data data key key - one - two by default groupby groups on axis= but you can group on any of the other axes for examplewe could group the columns of our example df here by dtype like soin [ ]df dtypes out[ ]data float data float key object key object in [ ]grouped df groupby(df dtypesaxis= in [ ]dict(list(grouped)out[ ]{dtype('float ')data - - - dtype('object')key key one two one two onedata selecting column or subset of columns indexing groupby object created from dataframe with column name or array of column names has the effect of selecting those columns for aggregation this means thatdf groupby('key ')['data 'df groupby('key ')[['data ']are syntactic sugar fordf['data 'groupby(df['key ']df[['data ']groupby(df['key '] data aggregation and group operations www it-ebooks info