Handling date objects in Python

Time series is data that is sampled at certain intervals over time, for example, recording the speed of a car every second. Given such data, we can easily estimate either the distance traveled (by summing the observations and dividing the sum by 3,600) or acceleration of the car (by calculating the differences between two consecutive observations). Managing time series data with pandas is straightforward.

Getting ready

To execute this recipe, you will need pandas, NumPy, and Matplotlib. No other prerequisites are necessary.

How to do it…

From the web archive, we cleaned up and transformed two datasets: water flow for the American River (http://www.theamericanriver.com) and for the Columbia River (http://www.ecy.wa.gov/programs/wr/cwp/cwpfactmap.html ...

Get Practical Data Analysis Cookbook 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.