ktk.TimeSeries.merge#
- TimeSeries.merge(ts, data_keys=[], *, resample=False, overwrite=False, on_conflict='warning', in_place=False)[source]#
Merge the TimeSeries with another TimeSeries.
- Parameters:
ts (TimeSeries) – The TimeSeries to merge into the current TimeSeries.
data_keys (str | list[str]) – Optional. The data keys to merge from ts. If left empty, all the data keys are merged.
resample (bool) – Optional. Set to True to resample the source TimeSeries to the target one using a linear interpolation. If the time attributes are not equivalent and resample is False, an exception is raised. To resample using other methods than linear interpolation, please resample the source TimeSeries manually before, using TimeSeries.resample. Default is False.
overwrite (bool) – Optional. Select what to do if a key from the source TimeSeries already exists in the destination TimeSeries. True to overwrite the already existing value, False to ignore the new value. Default is False.
on_conflict (str) –
Optional. Select what the warning level when a key from the source TimeSeries already exists in the destination TimeSeries. May take the following values:
”mute”: No warning;
”warning”: Warns that duplicate keys were found and how the conflict has been resolved following the overwrite` parameter.
”error”: Raises a TimeSeriesMergeConflictError.
Default is “warning”.
in_place (bool) – Optional. True to modify and return the original TimeSeries. False to return a modified copy of the TimeSeries while leaving the original TimeSeries intact. Default is False.
- Returns:
The merged TimeSeries.
- Return type:
- Raises:
TimeSeriesMergeConflictError – If a key from the source TimeSeries already exists in the destination TimeSeries and on_conflict is set to “error”.
Notes
All events are also merged from both TimeSeries.