Chapter 4: Aggregating Pandas DataFrames
In this chapter, we will continue our discussion of data wrangling from Chapter 3, Data Wrangling with Pandas, by addressing the enrichment and aggregation of data. This includes essential skills, such as merging dataframes, creating new columns, performing window calculations, and aggregating by group membership. Calculating aggregations and summaries will help us draw conclusions about our data.
We will also take a look at the additional functionality pandas
has for working with time series data, beyond the time series slicing we introduced in previous chapters, including how we can roll up the data with aggregation and select it based on the time of day. Much of the data we will encounter is time series data, so being able to effectively work with time series is paramount. Of course, performing these operations efficiently is important, so we will also review how to write efficient pandas
code.
This chapter will get us comfortable with...