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 ...

Get Learning pandas - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.