Session Ready
Exercise

Imputing missing values

When you have missing data points, how can you fill them in?

In this exercise, you'll practice using different interpolation methods to fill in some missing values, visualizing the result each time. But first, you will create the function (interpolate_and_plot()) you'll use to interpolate missing data points and plot them.

A single time series has been loaded into a DataFrame called prices.

Instructions 1/4
undefined XP
  • 1

    Create a boolean mask for missing values and interpolate the missing values using the interpolation argument of the function.

    • 2

      Interpolate using the latest non-missing value and plot the results.

      Recall that interpolate_and_plot's second input is a string specifying the kind of interpolation to use.

    • 3

      Interpolate linearly and plot the results.

    • 4

      Interpolate with a quadratic function and plot the results.