ktk.TimeSeries.remove_data

ktk.TimeSeries.remove_data#

TimeSeries.remove_data(data_key, *, in_place=False)[source]#

Remove a data key and its associated metadata.

Parameters:
  • data_key (str) – Name of the data key.

  • 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 TimeSeries with the removed data.

Return type:

TimeSeries

Raises:

KeyError – If this data key could not be found in the TimeSeries’ data attribute.

Example

>>> # Prepare a test TimeSeries with data "test"
>>> ts = ktk.TimeSeries()
>>> ts = ts.add_data("test", np.arange(10))
>>> ts = ts.add_data_info("test", "Unit", "m")
>>> ts.data
{'test': array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])}
>>> ts.data_info
{'test': {'Unit': 'm'}}
>>> # Now remove data "test"
>>> ts = ts.remove_data("test")
>>> ts.data
{}
>>> ts.data_info
{}