Exploring basic aggregations
Simple aggregations such as sum, mean, count, max, min, and so on are fundamental techniques to analyze and prepare your data. They provide a quick and efficient way to summarize and gain insights from large datasets. These operations also allow you to distill complex information into manageable, interpretable results.
In this recipe, we’ll cover how to use simple aggregations at the DataFrame and Series levels as well as in Polars’ expressions.
How to do it...
Here are the steps for exploring basic aggregations:
- Read the dataset into a DataFrame:
df = pl.read_csv('../data/contoso_sales.csv', try_parse_dates=True)
- Calculate aggregations at the DataFrame level, selecting only numeric columns:
from polars import selectors as cs (     df     .select(cs.numeric())     .sum() )
The preceding code will return the following output: