- Python for Data Analysis
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
- Preface
- 1. Preliminaries
- 2. Introductory Examples
- 3. IPython: An Interactive Computing and Development Environment
- 4. NumPy Basics: Arrays and Vectorized Computation
- 5. Getting Started with pandas
- 6. Data Loading, Storage, and File Formats
- 7. Data Wrangling: Clean, Transform, Merge, Reshape
- 8. Plotting and Visualization
- 9. Data Aggregation and Group Operations
- 10. Time Series
- 11. Financial and Economic Data Applications
- 12. Advanced NumPy
- A. Python Language Essentials
- Index
- About the Author
- Colophon
- SPECIAL OFFER: Upgrade this ebook with O’Reilly
- Copyright

Time series data is an important form of structured data in many
different fields, such as finance, economics, ecology, neuroscience, or
physics. Anything that is observed or measured at many points in time forms
a time series. Many time series are *fixed frequency*,
which is to say that data points occur at regular intervals according to
some rule, such as every 15 seconds, every 5 minutes, or once per month.
Time series can also be *irregular* without a fixed unit
or time or offset between units. How you mark and refer to time series data
depends on the application and you may have one of the following:

*Timestamps*, specific instants in timeFixed

*periods*, such as the month January 2007 or the full year 2010*Intervals*of time, indicated by a start and end timestamp. Periods can be thought of as special cases of intervalsExperiment or elapsed time; each timestamp is a measure of time relative to a particular start time. For example, the diameter of a cookie baking each second since being placed in the oven

In this chapter, I am mainly concerned with time series in the first 3 categories, though many of the techniques can be applied to experimental time series where the index may be an integer or floating point number indicating elapsed time from the start of the experiment. The simplest and most widely used kind of time series are those indexed by timestamp.

pandas provides a standard set of time series tools and data algorithms. With this, you can efficiently work ...