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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.