grouped and the group names function to be invoked on the axis index or the individual labels in the index note that the latter three methods are all just shortcuts for producing an array of values to be used to split up the object don' worry if this all seems very abstract throughout this will give many examples of all of these methods to get startedhere is very simple small tabular dataset as dataframein [ ]df dataframe({'key [' '' '' '' '' ']'key ['one''two''one''two''one']'data np random randn( )'data np random randn( )}in [ ]df out[ ]data - - - data key key one two one two one suppose you wanted to compute the mean of the data column using the groups labels from key there are number of ways to do this one is to access data and call groupby with the column ( seriesat key in [ ]grouped df['data 'groupby(df['key ']in [ ]grouped out[ ]this grouped variable is now groupby object it has not actually computed anything yet except for some intermediate data about the group key df['key 'the idea is that this object has all of the information needed to then apply some operation to each of the groups for exampleto compute group means we can call the groupby' mean methodin [ ]grouped mean(out[ ]key - lateri'll explain more about what' going on when you call mean(the important thing here is that the data ( serieshas been aggregated according to the group keyproducing new series that is now indexed by the unique values in the key column the result index has the name 'key because the dataframe column df['key 'did if instead we had passed multiple arrays as listwe get something differentin [ ]means df['data 'groupby([df['key ']df['key ']]mean(groupby mechanics www it-ebooks info