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

Performing frequency conversion on a time-series

Frequency data can be converted in pandas using the .asfreq() method of a time-series object. When converting frequency, a new Series object with a new DatatimeIndex object will be created. The DatetimeIndex of the new Series object starts at the first Timestamp of the original and progresses at the given frequency until the last Timestamp of the original. Values will then be aligned into the new Series.

To demonstrate, we will use the following time series of consecutive incremental integers mapped into each hour of each day for August 2014:

The following converts this time series to a daily ...

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