O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Indexing periods of time using PeriodIndex

It is also important to be able to represent periods such as a day, month, or year. This is much like an interval but for a period of time. These scenarios can be modeled by using the PeriodIndex and specifying a specific frequency for the periods in the index.

The following demonstrates by modeling three 1-month periods starting from 2017-01.

And this index can then be used within a Series or DataFrame.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required