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
In [1]: importpandasaspd, cudfIn [2]: cudf.Series(["s", "b"]) ==cudf.Series([1, 2])
...
113elifisinstance(data, abc.MutableMapping):
114# This code path is performance-critical for copies and should be115# modified with care.116ifdataandverify:
117# Faster than next(iter(data.values()))-->118column_length=len(data[next(iter(data))])
119# TODO: we should validate the keys of `data`120forcolindata.values():
TypeError: objectoftype'bool'hasnolen()
In [3]: pd.Series(["s", "b"]) ==pd.Series([1, 2])
Out[3]:
0False1Falsedtype: bool
Expected behavior
Same as Out[3]
Additional context Column._binarop does return NotImplemented when encountering an incomparable type to dispatch to the reflected's implementation, but if the other side return NotImplemented then we get a scalar boolean which we are not expecting.
Generally if we can narrow the inputs to _binarop to a Column (scalars get broadcast to len of the column), then we should be more aggressively raise TypeError instead of return NotImplemented for invalid type comparisons.
The text was updated successfully, but these errors were encountered:
mroeschke
changed the title
[BUG] == or != between incomparable types raises TypeError insted of returning an object with True/False
[BUG] == or != between incomparable types raises TypeError instead of returning an object with True/False
Mar 7, 2025
Describe the bug
Expected behavior
Same as
Out[3]
Additional context
Column._binarop
doesreturn NotImplemented
when encountering an incomparable type to dispatch to the reflected's implementation, but if the other sidereturn NotImplemented
then we get a scalar boolean which we are not expecting.Generally if we can narrow the inputs to
_binarop
to aColumn
(scalars get broadcast to len of the column), then we should be more aggressivelyraise TypeError
instead ofreturn NotImplemented
for invalid type comparisons.The text was updated successfully, but these errors were encountered: