With time series, we have some additional operations we can use, for anything from selection and data wrangling to aggregation. When we have time series data, we should set the index to our date (or datetime) column, which will allow us to take advantage of what we will discuss in this section. Some operations may work without doing this, but for a smooth process throughout our analysis, using a DatetimeIndex is recommended.
For this section, we will be working in the 4-time_series.ipynb notebook. We will start off by working with the Facebook data from previous sections:
>>> import numpy as np
>>> import pandas as pd
>>> fb = pd.read_csv(
... 'data/fb_2018.csv', index_col='date', parse_dates=True
... ).assign(
... trading_volume=lambda x: pd.cut(
... x.volume, bins=3, labels=['low', 'med&apos...