Skip to content

temporian.EventSet.moving_min #

moving_min(
    window_length: WindowLength,
    sampling: Optional[EventSetOrNode] = None,
) -> EventSetOrNode

Computes the minimum of values in a sliding window over an EventSet.

For each t in sampling, and for each index and feature independently, returns at time t the minimum of non-nan values for the feature in the window (t - window_length, t].

sampling can't be specified if a variable window_length is specified (i.e. if window_length is an EventSet).

If sampling is specified or window_length is an EventSet, the moving window is sampled at each timestamp in them, else it is sampled on the input's.

If the window does not contain any values (e.g., all the values are missing, or the window does not contain any sampling), outputs missing values.

Example
>>> a = tp.event_set(
...     timestamps=[0, 1, 2, 5, 6, 7],
...     features={"value": [np.nan, 1, 5, 10, 15, 20]},
... )

>>> b = a.moving_min(tp.duration.seconds(4))
>>> b
indexes: ...
    (6 events):
        timestamps: [0. 1. 2. 5. 6. 7.]
        'value': [nan 1. 1. 5. 10. 10.]
...

See EventSet.moving_count() for examples of moving window operations with external sampling and indices.

Parameters:

Name Type Description Default
window_length WindowLength

Sliding window's length.

required
sampling Optional[EventSetOrNode]

Timestamps to sample the sliding window's value at. If not provided, timestamps in the input are used.

None

Returns:

Type Description
EventSetOrNode

EventSet containing the minimum of each feature in the input.