We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6dfa5fc commit 78547a9Copy full SHA for 78547a9
pandas/core/series.py
@@ -117,6 +117,10 @@ def na_op(x, y):
117
else:
118
result = lib.scalar_compare(x, y, op)
119
120
+ if (isinstance(x, np.ndarray) and
121
+ isinstance(y, np.ndarray) and
122
+ len(x) != len(y)):
123
+ raise ValueError('Array lengths must equal to compare')
124
result = op(x, y)
125
126
return result
pandas/tests/test_series.py
@@ -1598,6 +1598,10 @@ def test_comparison_different_length(self):
1598
b = Series(['b', 'a'])
1599
self.assertRaises(ValueError, a.__lt__, b)
1600
1601
+ a = Series([1, 2])
1602
+ b = Series([2, 3, 4])
1603
+ self.assertRaises(ValueError, a.__eq__, b)
1604
+
1605
def test_between(self):
1606
s = Series(bdate_range('1/1/2000', periods=20).asobject)
1607
s[::2] = np.nan
0 commit comments