March 2020
Beginner to intermediate
352 pages
8h 40m
English
Time-based indexing is a very powerful method of the pandas library when it comes to time series data. Having time-based indexing allows using a formatted string to select data. See the following code, for example:
df_power.loc['2015-10-02']
The output of the preceding code is given here:
Consumption 1391.05Wind 81.229Solar 160.641Wind+Solar 241.87Year 2015Month 10Weekday Name FridayName: 2015-10-02 00:00:00, dtype: object
Note that we used the pandas dataframe loc accessor. In the preceding example, we used a date as a string to select a row. We can use all sorts of techniques to access rows just as we can do with a normal dataframe index.
Read now
Unlock full access