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 using the PeriodIndex

A series of Period objects can be combined into a special form of pandas index known as PeriodIndex. A PeriodIndex index is useful for being able to associate data to specific intervals of time and with being able to slice and perform analysis on the events in each interval.

The following creates a PeriodIndex consisting of 1-month intervals for the year 2013:

PeriodIndex differs from DatetimeIndex in that the index labels are Period objects. The following prints the start and end times for all the Period objects in the index:

pandas has determined the start and end of each month while taking into account the ...

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