Transforming data into the time series format