Working with Time Series Data
Unit 4, Flex
Materials We Provide
Topic | Description | Link |
---|---|---|
Lesson | Part I. Working With Time Series Data | Here |
Part II. Rolling Statistics | Here | |
Part III. Autocorrelation | Here | |
Part IV. Decomposition | Here | |
Practice | Part V. Time Series Practice | Here |
Lesson | (Bonus) Part VI. Time Series Forecasting Models | Here |
Solutions | Sample solutions for lesson prompts and practice activity | Here |
Data | 10 datasets used in lesson samples and practice activities | Here |
Learning Objectives
After this lessons, students will be able to:
Explain how time series data are distinct and how to account for that.
Create rolling means and plot time series data.
Perform autocorrelation on sample time series data.
Decompose time series data into trend and residual components.
Bonus: Explain the benefits and drawbacks of ARIMA as compared to other methods.
Student Requirements
Before this lesson(s), students should already be able to:
Manipulate data with Pandas.
Create basic data visualizations with Matplotlib and Seaborn.
Define and demonstrate techniques for correlating data points.
Lesson Outline
TOTAL (190 min) I. Foundations (190 min)
Part 1: Time Series Data (20 min)
What is Time Series Data?
Examples of Time Series Data and Domains That Find it Useful
Trends and Seasonality
Preprocessing Time Series Data With Pandas
Processing Date Information as datetime Objects
Filtering by Date With Pandas
Differencing/Lagging
Practice (15 min)
Part 2: Rolling Means and Plotting Time Series Data (20 min)
What is a Trend?
Visualizing Trends
Computing Aggregates With Pandas' .resample() Function
Computing Rolling Averages With Pandas
Other Pandas Window Functions (Rolling Sum, Rolling Max, Diff)
Exponentially Weighted Windows
Plotting Time Series Data
Practice (15 min)
Part 3: Autocorrelation on Time Series Data (25 min)
Define Autocorrelation
Examples of Autocorrelation
Computing Autocorrelation
Using the Pandas autocorr() Function Calculating and Plotting ACF and PACF Using StatsModels
Practice (15 min)
Part 4: Decomposing Time Series (15 min)
Decomposing Time Series Into Trend, Seasonality, Cyclical, and Residual Components
Using the .seasonal_decompose() Function
Plotting the Seasonal, Trend, and Residual Components of a Time Series
Practice (15 min)
Closing and Recap (5 min) II. Bonus (30 min)
Time Series Forecasting Models (25 min)
What are Time Series Models?
Properties of Time Series Models
Assumption of Stationarity
Compare/Contrast Time Series Forecasting Models
Closing and Recap (5 min)
Additional Resources
If you are interested in more resources, check out the following:
In Pandas' datetime library, search for more information on .dt here.
For additional review of these concepts, see some inspiration from the Python Data Science Handbook.
There are lots of additional tutorials on ARIMA models out there; here is a good one.