concat#
- temporaldata.concat(objs, sort=True)[source]#
Concatenates multiple time series objects into a single object.
- Parameters:
objs (List[Union[IrregularTimeSeries, RegularTimeSeries]]) – List of time series objects to concatenate.
sort (bool, optional) – Whether to sort the resulting time series by timestamps. Only applies to IrregularTimeSeries. Defaults to True.
- Returns:
The concatenated time series object.
- Return type:
Union[IrregularTimeSeries, RegularTimeSeries]
- Raises:
ValueError – If objects are not all of the same type or don’t have matching keys.
NotImplementedError – If concatenation is not implemented for the given object type.
Example
>>> import numpy as np >>> from temporaldata import IrregularTimeSeries, Interval, concat >>> ts1 = IrregularTimeSeries( ... timestamps=np.array([0.0, 1.0]), ... values=np.array([1.0, 2.0]), ... domain="auto", ... ) >>> ts2 = IrregularTimeSeries( ... timestamps=np.array([2.0, 3.0]), ... values=np.array([3.0, 4.0]), ... domain="auto", ... ) >>> ts_concat = concat([ts1, ts2]) >>> ts_concat IrregularTimeSeries( timestamps=[4], values=[4] ) >>> ts_concat.timestamps array([0., 1., 2., 3.])