Skip to content

temporian.EventSet.assign #

assign(**others: EventSetOrNode) -> EventSetOrNode

Assign new features to an EventSet.

If the name provided already exists on the EventSet, the feature is overriden.

Usage example
>>> a = tp.event_set(
...     timestamps=[1, 2],
...     features={'A': [1, 2]},
... )
>>> b = tp.event_set(
...     timestamps=[1, 2],
...     features={'B': [3, 4]},
...     same_sampling_as=a,
... )
>>> ab = a.assign(new_name=b)
>>> ab
indexes: []
features: [('A', int64), ('new_name', int64)]
events:
    (2 events):
        timestamps: [1. 2.]
        'A': [1 2]
        'new_name': [3 4]
...
>>> ab = a.assign(B=b, B2=b['B'] * 2)
>>> ab
indexes: []
features: [('A', int64), ('B', int64), ('B2', int64)]
events:
    (2 events):
        timestamps: [1. 2.]
        'A': [1 2]
        'B': [3 4]
        'B2': [6 8]
...

Parameters:

Name Type Description Default
**others EventSetOrNode

The argument name is going to be used as the new feature name. The EventSets need to have a single feature

{}

Returns:

Type Description
EventSetOrNode

EventSet with the added feature.