Skip to content

temporian.EventSet.equal #

equal(other: Any) -> EventSetOrNode

Checks element-wise equality of an EventSet to another one or to a single value.

Each feature is compared element-wise to the feature in other in the same position. Note that it will always return False on NaN elements.

Inputs must have the same sampling and the same number of features.

Example
>>> a = tp.event_set(
...     timestamps=[1, 2, 3],
...     features={"f1": [0, 100, 200]}
... )
>>> b = tp.event_set(
...     timestamps=[1, 2, 3],
...     features={"f2": [-10, 100, 5]},
...     same_sampling_as=a
... )

>>> # WARN: Don't use this for element-wise comparison
>>> a == b
False

>>> # Element-wise comparison to a scalar value
>>> c = a.equal(100)
>>> c
indexes: []
features: [('f1', bool_)]
events:
    (3 events):
        timestamps: [1. 2. 3.]
        'f1': [False True False]
...

>>> # Element-wise comparison between two EventSets
>>> c = a.equal(b)
>>> c
indexes: []
features: [('eq_f1_f2', bool_)]
events:
    (3 events):
        timestamps: [1. 2. 3.]
        'eq_f1_f2': [False True False]
...

Parameters:

Name Type Description Default
other Any

Second EventSet or single value to compare.

required

Returns:

Type Description
EventSetOrNode

EventSet with boolean features.