TimeSeries

class ticts.timeseries.TimeSeries(data=None, default=No default, name='value', permissive=True, tz='UTC')[source]

TimeSeries object.

Parameters:
  • default – The default value of timeseries.
  • permissive (bool) – Whether to allow accessing non-existing values or not. If is True, getting non existing item returns None. If is False, getting non existing item raises.
compact()[source]

Convert this instance to a compact version: consecutive measurement of the same value are discarded.

Returns:TimeSeries
empty

Return whether the TimeSeries is empty or not.

iterintervals(end=None)[source]

Iterator that contain start, end of intervals.

Parameters:end (datetime) – right bound of last interval.
lower_bound

Return the lower bound time index.

set_interval(start, end, value)[source]

Set a value for an interval of time.

Parameters:
  • start (datetime or str) – lower bound
  • end (datetime or str) – upper bound
  • value – the value to be set
Returns:

self

Raises:

NotImplementedError – when no default is set.

slice(start, end)[source]

Slice your timeseries for give interval.

Parameters:
  • start (datetime or str) – lower bound
  • end (datetime or str) – upper bound
Returns:

TimeSeries sliced

upper_bound

Return the upper bound time index.