course content

Course Content

Python for Data Science: Time Series Essentials

Time Series DecompositionTime Series Decomposition

A time series is a set of data points collected at regular intervals, typically used to analyze and make predictions about trends and patterns in the data over time. The main components of a time series in Python include:

  • Time stamp: The time stamp is the time at which each data point was collected. Time stamps are typically in the format of a date, time, or datetime object and are used to order the data points in a time series;
  • Trend: The trend is a long-term increase or decrease in the data values. Trends can be determined by analyzing the slope of the line of best fit through the data points over time;
  • Seasonality: Seasonality is a regular pattern that occurs at a specific time or over a specific time period. This is usually a repeating pattern that happens every year, month, or other time frames;
  • Noise: Noise represents the random variations in the data that do not follow any trend or seasonality. This could be due to measurement errors, random fluctuations, or other factors that are not part of the underlying pattern in the data.

In Python pandas library provides some functionalities to work with time series data like resampling, shifting, and rolling. And also, python has libraries like statsmodels, prophet, and fbprophet for time series forecasting.


  1. Import statsmodels as sm;
  2. Use seasonal_decompose to decompose your series;
  3. Plot the results.

Everything was clear?

Section 1. Chapter 6