You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EventSet < EventSet works with two numerical EventSets
EventSet < int works with a numerical EventSet
EventSet < EventSet works with two string EventSets
EventSet < str doesn't work with a string EventSet, and it should:
In [1]: importtemporianastpIn [2]: evset=tp.event_set([1], features={'a': [3]})
In [3]: evset<4Out[3]:
indexes: []
features: [('a', bool_)]
events:
(1events):
timestamps: [1.]
'a': [ True]
memoryusage: 0.5kBIn [4]: evset=tp.event_set([1], features={'a': ['a']})
In [5]: evset<'b'---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
CellIn[8], line1---->1evset<'b'File~/temporian/temporian/core/event_set_ops.py:1233, inEventSetOperations.__lt__(self, other)
1229fromtemporian.core.operators.scalarimportless_scalar1231returnless_scalar(input=self, value=other)
->1233self._raise_error("compare", other, "(int,float)")
1234assertFalseFile~/temporian/temporian/core/event_set_ops.py:88, inEventSetOperations._raise_error(self, op_name, other, allowed_types)
80def_raise_error(
81self, op_name: str, other: Any, allowed_types: str82 ) ->None:
83"""Raises an error message. 84 85 This utility method is used in operator implementations, e.g., +, - *. 86 """--->88raiseValueError(
89f"Cannot use operator '{op_name}' on {self._clsname} and"90f" {type(other)} objects. Only {self._clsname} or values of type"91f" ({allowed_types}) are supported."92 )
ValueError: Cannotuseoperator'compare'onEventSetand<class'str'>objects. OnlyEventSetorvaluesof type ((int,float)) aresupported.
Same goes for all other comparison ops.
The T_SCALAR tuple defined in temporian/core/event_set_ops.py only accounts for (int, float), but in some ops it should include str too. A second tuple needs to be defined for it and used where appropiate.
Note that equal and __ne__ in the same file use T_SCALAR + (bool, str), which could be defined as a third option.
Thorough tests needed to ensure we are accepting and rejecting the correct type on each op.
The text was updated successfully, but these errors were encountered:
EventSet < EventSet
works with two numerical EventSetsEventSet < int
works with a numerical EventSetEventSet < EventSet
works with two string EventSetsEventSet < str
doesn't work with a string EventSet, and it should:Same goes for all other comparison ops.
The
T_SCALAR
tuple defined intemporian/core/event_set_ops.py
only accounts for(int, float)
, but in some ops it should includestr
too. A second tuple needs to be defined for it and used where appropiate.Note that
equal
and__ne__
in the same file useT_SCALAR + (bool, str)
, which could be defined as a third option.Thorough tests needed to ensure we are accepting and rejecting the correct type on each op.
The text was updated successfully, but these errors were encountered: