[1]:
# Import to be able to import python package from src
import sys
sys.path.insert(0, '../src')
[3]:
import pandas as pd
import numpy as np
import ontime as on
The `LightGBM` module could not be imported. To enable LightGBM support in Darts, follow the detailed instructions in the installation guide: https://github.com/unit8co/darts/blob/master/INSTALL.md
The `Prophet` module could not be imported. To enable Prophet support in Darts, follow the detailed instructions in the installation guide: https://github.com/unit8co/darts/blob/master/INSTALL.md

Time Series#

a TimeSeries is the basic object in onTime. It is basically an extended version of Darts TimeSeries. Therefore, it is multivariate by default and all Darts methods can be used.

Get some data#

Let’s generate a random walk time series

[4]:
ts = on.generators.random_walk().generate(start=pd.Timestamp('2022-01-01'), end=pd.Timestamp('2022-12-31'))

The TimeSeries can be sliced and its data structure is an xarray.

[5]:
ts[0:5]
[5]:
<TimeSeries (DataArray) (time: 5, component: 1, sample: 1)>
array([[[-0.36981256]],

       [[-1.89552543]],

       [[-3.58416814]],

       [[-4.19590597]],

       [[-3.08642833]]])
Coordinates:
  * time       (time) datetime64[ns] 2022-01-01 2022-01-02 ... 2022-01-05
  * component  (component) object 'random_walk'
Dimensions without coordinates: sample
Attributes:
    static_covariates:  None
    hierarchy:          None

Plot#

As expected, you can call the plot() methdod

[6]:
ts.plot();
../../_images/user_guide_0_core_0.1_time-series_9_0.png
[ ]: