Loading tutorials
groupby call and what it returns.2 min readgroupby splits rows into groups, applies a function to each group, and combines the results.2 min readdf.groupby("region") creates a GroupBy object. That object holds the groups and does no calculation until you ask for one.1 min readgroupby(...).sum(). It covers the two ways to count rows per group and why they can disagree.2 min readgroupby("region")["revenue"].sum(). Here you will compute several summaries in one call and control the names of the output columns.2 min readgroupby(...).sum(). Here you will learn why the result of an aggregation has the index it has, and how to turn it into the layout you need.2 min readgroupby(...).sum(). It covers two things that change which groups appear in the result and the order they appear in: missing group keys and the sort parameter.2 min readdf.groupby(...) and a basic aggregation. A GroupBy object is lazy. It records how to split the rows but computes nothing until you aggregate. Before you aggregate, you can look at the groups themselves.2 min readgroupby(...).agg(...) call and that you know how pandas aligns a Series to a DataFrame by index label.2 min readgroupby with sum and agg. You should also know what transform returns, since filter is closely related to it.2 min readgroupby with agg, transform, and filter, and that you know how to build a DataFrame and select columns. When none of those fit, apply runs any function you write on each group.2 min readgroupby(...).sum(). It also assumes you know what a datetime column is. The goal is to group rows into calendar periods such as months or weeks without writing any date arithmetic yourself.2 min readsum or mean. It also assumes you know what a pandas category dtype is, meaning a column that stores a fixed set of allowed values.2 min readagg, transform, filter, and apply, and that you can read a groupby result's index. It covers the mistakes that produce wrong numbers without raising an error, and the habits that keep groupby fast.2 min read