Indexing a Date Range with loc from last Date using index or iloc

Опубликовано: 06 Апрель 2026
на канале: Ralph Turchiano
126
like

A neat little lazy trick I discovered when trying to keep a running 7 day charts from the present-day to the preceding 7 days when Date is in the index. Once you get the concept, you may have to modify depending on the characteristics of each data frame ( Pandas )

Code used in video:

owid.loc[str(owid.index[a]):str(owid.index[b])]

#shorts #dateindex #loc