TimeSeries.remove_event(name, occurrence=None, *, in_place=False)[source]#

Remove an event occurrence or all events of a same name.

  • name (str) – Name of the event to look for in the events list.

  • occurrence (Optional[int]) – Optional. i_th occurence of the event to look for in the events list, starting at 0, where the occurrences are sorted in time. If None (default), all occurences of this event name or removed.

  • 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.


The TimeSeries with the removed event.

Return type



>>> # Instanciate a timeseries with some events
>>> ts = ktk.TimeSeries()
>>> ts = ts.add_event(5.5, "event1")
>>> ts = ts.add_event(10.8, "event2")
>>> ts = ts.add_event(2.3, "event2")
>>> ts.events
[TimeSeriesEvent(time=5.5, name='event1'),
 TimeSeriesEvent(time=10.8, name='event2'),
 TimeSeriesEvent(time=2.3, name='event2')]
>>> ts = ts.remove_event("event1")
>>> ts.events
[TimeSeriesEvent(time=10.8, name='event2'),
 TimeSeriesEvent(time=2.3, name='event2')]
>>> ts = ts.remove_event("event2", 1)
>>> ts.events
[TimeSeriesEvent(time=2.3, name='event2')]