temporian.EventSet.before #
before(
timestamp: Union[int, float, datetime]
) -> EventSetOrNode
Filters events EventSet
that happened before
a particular timestamp.
The timestamp can be a datetime if the EventSet's timestamps are unix timestamps.
The comparison is strict, meaning that the obtained timestamps would be
less than (<
) the provided timestamp.
This operation is equivalent to:
input.filter(input.timestamps() < timestamp)
Usage example
>>> a = tp.event_set(
... timestamps=[0, 1, 5, 6],
... features={"f1": [0, 10, 50, 60]},
... )
>>> a.before(5)
indexes: []
features: [('f1', int64)]
events:
(2 events):
timestamps: [0. 1.]
'f1': [ 0 10]
...
>>> from datetime import datetime
>>> a = tp.event_set(
... timestamps=[datetime(2022, 1, 1), datetime(2022, 1, 2)],
... features={"f1": [1, 2]},
... )
>>> a.before(datetime(2022, 1, 1, 12))
indexes: []
features: [('f1', int64)]
events:
(1 events):
timestamps: ['2022-01-01T00:00:00']
'f1': [1]
...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timestamp |
Union[int, float, datetime]
|
EventSet with a single boolean feature. |
required |
Returns:
Type | Description |
---|---|
EventSetOrNode
|
Filtered EventSet. |