Examples
import numpy as np
import pandas as pd
i = pd.date_range('2019-04-09', periods=5, freq='2D')
ts = pd.DataFrame({'P': [1,2,3,4,5]}, index=i)
ts
Get the rows for the last 3 days:
ts.last('3D')
Note:in the above output the data for 3 last calender days were returned, not the last
3 observed days
in the dataset, and therefore data for 2019-04-11 was not returned.