STAT C100 Lecture Notes - Lecture 3: Amortized Analysis, Aggregate Function
Document Summary
Goals for today: discuss aggregation operations, groupby, pivot. Identifying/dealing with ugly data: operations for identifying with null or strange values, operations for modifying data frames, more case study. If we call groupby on a series: the resulting output is a seriesgroupby object, the series that are passed as arguments to groupby must share an index with the calling series. Seriesgroupby objects can then be aggregated back into a series using an aggregation method. If we call groupby on a dataframe: the resulting output is a dataframegroupby object. Dataframegroupby objects can then be aggregated back into a dataframe or a series using an aggregation method. Most of the built-in handy aggregation methods are just shorthand for a universal aggregation method called agg: example, . mean() is just . agg(np. mean). If we group a series (or dataframe) by multiple series and then perform an aggregation operation, the resulting series (or dataframe) will have a multiindex.