[1]:
# Import to be able to import python package from src
import sys
sys.path.insert(0, '../src')
[ ]:
import pandas as pd
import ontime as on
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
[3]:
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.
[4]:
ts[0:5]
[4]:
<TimeSeries (DataArray) (time: 5, component: 1, sample: 1)> Size: 40B array([[[ 0.49300558]], [[ 0.07955401]], [[ 0.0028518 ]], [[ 0.26707493]], [[-1.48484355]]]) Coordinates: * time (time) datetime64[ns] 40B 2022-01-01 2022-01-02 ... 2022-01-05 * component (component) object 8B 'random_walk' Dimensions without coordinates: sample Attributes: static_covariates: None hierarchy: None
Plot#
As expected, you can call the plot()
method
[7]:
ts.plot()
[7]: