## #MonthOfJulia Day 15: Time Series

Yesterday we looked at Julia’s support for tabular data, which can be represented by a DataFrame. The TimeSeries package implements another common data type: time series. We’ll start by loading the TimeSeries package, but we’ll also add the Quandl package, which provides an interface to a rich source of time series data from Quandl.

We’ll start by getting our hands on some data from Yahoo Finance. By default these data will be of type TimeArray, although it is possible to explicitly request a DataFrame instead,

Having a closer look at one of the TimeSeries objects we find that it actually consists of multiple data series, each represented by a separate column. The colnames attribute gives names for each of the component series, while the timestamp and values attributes provide access to the data themselves. We’ll see more convenient means for accessing those data in a moment.

The TimeArray type caters for a full range of indexing operations which allow you to slice and dice those data to your exacting requirements. to() and from() extract subsets of the data before or after a specified instant.

We can shift observations forward or backward in time using lag() or lead().

We can also calculate the percentage change between observations.

Well, that’s the core functionality in TimeSeries. There are also methods for aggregation and moving window operations, as well as time series merging. You can check out some examples in the documentation as well as on github. Finally, watch the video below from JuliaCon 2014.