The time series as an index
In many of the examples so far, we have had a column in a DataFrame containing dates or datetime
information, and we've manipulated that. In many cases, when we want to perform operations on time-stamped data, it is simpler and more natural to have a time-based index. In general, you may want to consider time series to refer to a data structure with a time-based index and one or more columns of data. Let's explore a bit more what we can do with such a time series.
Time series periods/frequencies
We've seen the use of the pandas .date_range()
method to generate a sequence of dates. The method is intuitive; we simply provide the start
, end
, and optional frequency (freq
) arguments. The latter is the key to a lot of the convenience provided by pandas. The freq
argument can take many values, and we've summarized them here.