We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bca2c9 commit d64c7dfCopy full SHA for d64c7df
pandas/core/arrays/base.py
@@ -917,6 +917,10 @@ def _add_comparison_ops(cls):
917
cls.__le__ = cls._create_comparison_method(operator.le)
918
cls.__ge__ = cls._create_comparison_method(operator.ge)
919
920
+ def _validate_shape(self, other):
921
+ if len(self) != len(other):
922
+ raise ValueError('Lengths must match to compare')
923
+
924
925
class ExtensionScalarOpsMixin(ExtensionOpsMixin):
926
"""
pandas/core/arrays/period.py
@@ -67,8 +67,7 @@ def wrapper(self, other):
67
elif isinstance(other, cls):
68
self._check_compatible_with(other)
69
70
- if other.ndim > 0 and len(self) != len(other):
71
- raise ValueError('Lengths must match to compare')
+ self._validate_shape(other)
72
73
if not_implemented:
74
return NotImplemented
0 commit comments