Exercise

# Rolling quantiles for daily air quality in nyc

You learned in the last video how to calculate rolling quantiles to describe changes in the dispersion of a time series over time in a way that is less sensitive to outliers than using the mean and standard deviation.

Let's calculate rolling quantiles - at 10%, 50% (median) and 90% - of the distribution of daily average ozone concentration in NYC using a 360-day rolling window.

Instructions

**100 XP**

We have already imported `pandas`

as `pd`

and `matplotlib.pyplot`

as `plt`

. We have also loaded the ozone data from 2000-2017 into the variable `data`

.

- Apply
`.resample()`

with daily frequency`'D'`

to`data`

and apply`.interpolate()`

to fill missing values, and reassign to`data`

. - Inspect the result using
`.info()`

. - Create a
`.rolling()`

window using 360 periods, select the column`'Ozone'`

, and assign the result to`rolling`

. - Insert three new columns,
`'q10'`

,`'q50'`

and`'q90'`

into`data`

, calculating the respective quantiles from`rolling`

. - Plot
`data`

.