1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning for Time Series Data in Python

Exercise

Creating time-shifted features

In machine learning for time series, it's common to use information about previous time points to predict a subsequent time point.

In this exercise, you'll "shift" your raw data and visualize the results. You'll use the percent change time series that you calculated in the previous chapter, this time with a very short window. A short window is important because, in a real-world scenario, you want to predict the day-to-day fluctuations of a time series, not its change over a longer window of time.

Instructions

100 XP
  • Use a dictionary comprehension to create multiple time-shifted versions of prices_perc using the lags specified in shifts.
  • Convert the result into a DataFrame.
  • Use the given code to visualize the results.