Representing time series data in Go
There are purpose-built systems to store and work with time series data. Some of these are even written in Go, including Prometheus and InfluxDB. However, some of the tooling that we have already utilized in the book is also suitable to handle time series. Specifically, github.com/kniren/gota/dataframe
, gonum.org/v1/gonum/floats
, and gonum.org/v1/gonum/mat
can help us as we are working with time series data.
Take, for example, a dataset that includes a time series representing the number of international air passengers during the years 1949-1960 (available for download at https://raw.github.com/vincentarelbundock/Rdatasets/master/csv/datasets/AirPassengers.csv):
$ head AirPassengers.csv
time,AirPassengers
1949.0,112
1949.08333333,118
1949.16666667,132
1949.25,129
1949.33333333,121
1949.41666667,135
1949.5,148
1949.58333333,148
1949.66666667,136
Here, the time
column includes a series of times represented by a year along with a decimal, and the AirPassengers...