liveBook · Manning

Resampling

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

Resampling is the process of changing the temporal frequency of time-indexed data, commonly by aggregating observations into new time periods.

Resampling changes the time scale of time-indexed data: like sorting events into calendar bins, it groups observations by periods such as days, weeks, months, or years and supports aggregation. section 10.0 section 10.8

Count Apollo missions in six-month periods

After converting the Apollo launch dates and setting Date as the index, use df.resample('6M').count() to produce one count for each six-month period. Numeric time-series data can likewise be summarized with mean or std. section 10.8

Use resampling when the question asks for a summary over recurring time windows:

  • Choose a period, such as one day, two weeks, six months, or one year. section 10.8
  • Apply an aggregation such as count, mean, or standard deviation. section 10.8
  • Check that the data is a time series with a datetime column serving as its index. section 10.17

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Explains resampling as time-based groupby and demonstrates period selection with count, mean, and standard deviation, without internals.
Examples
Uses Apollo launch dates to count missions in six-month periods and mentions daily, biweekly, monthly, and yearly summaries.
What it assumes
Assumes familiarity with data frames and indexes, while requiring a datetime index for time-series resampling.
What you can do after
Apply it via pandas to aggregate a time-indexed data frame over selected time periods.
How it connects
Connects resampling with time series, datetime indexes, grouping, and aggregation methods.

Also explained in

Compare how 3 books explain resampling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.