Delete a range of datapoints

async AsyncCogniteClient.time_series.data.delete_range(
start: int | str | datetime,
end: int | str | datetime,
id: int | None = None,
external_id: str | None = None,
instance_id: NodeId | None = None,
) None

Delete a range of datapoints from a time series.

Parameters:
  • start (int | str | datetime.datetime) – Inclusive start of delete range

  • end (int | str | datetime.datetime) – Exclusive end of delete range

  • id (int | None) – Id of time series to delete data from

  • external_id (str | None) – External id of time series to delete data from

  • instance_id (NodeId | None) – Instance ID of time series to delete data from

Examples

Deleting the last week of data from a time series:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> client.time_series.data.delete_range(start="1w-ago", end="now", id=1)

Deleting the data from now until 2 days in the future from a time series containing e.g. forecasted data:

>>> client.time_series.data.delete_range(start="now", end="2d-ahead", id=1)