Skip to content

Commit a0c36e2

Browse files
Shawn DionShawn Dion
Shawn Dion
authored and
Shawn Dion
committed
BUG pandas-dev#13006 comparsion with dim 0 arrays now work
1 parent 15cc6e2 commit a0c36e2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

pandas/core/ops.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,18 @@ def wrapper(self, other, axis=None):
738738
elif isinstance(other, pd.DataFrame): # pragma: no cover
739739
return NotImplemented
740740
elif isinstance(other, (np.ndarray, pd.Index)):
741-
if len(self) != len(other):
742-
raise ValueError('Lengths must match to compare')
743-
return self._constructor(na_op(self.values, np.asarray(other)),
744-
index=self.index).__finalize__(self)
741+
try:
742+
if len(self) != len(other):
743+
raise ValueError('Lengths must match to compare')
744+
return self._constructor(na_op(self.values,
745+
np.asarray(other)),
746+
index=
747+
self.index).__finalize__(self)
748+
except:
749+
return self._constructor(na_op(self.values,
750+
np.asarray(other)),
751+
index=
752+
self.index).__finalize__(self)
745753
elif isinstance(other, pd.Categorical):
746754
if not is_categorical_dtype(self):
747755
msg = ("Cannot compare a Categorical for op {op} with Series "

0 commit comments

Comments
 (0)