Skip to content

Commit 6d75e55

Browse files
committed
BUG: It makes sense to also catch ValueErrors
1 parent b6c9233 commit 6d75e55

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pandas/indexes/numeric.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,8 @@ def equals(self, other):
164164
if self.is_(other):
165165
return True
166166

167-
try:
168-
return com.array_equivalent(com._values_from_object(self),
169-
com._values_from_object(other))
170-
except TypeError:
171-
# e.g. fails in numpy 1.6 with DatetimeIndex #1681
172-
return False
167+
return com.array_equivalent(com._values_from_object(self),
168+
com._values_from_object(other))
173169

174170
def _wrap_joined_index(self, joined, other):
175171
name = self.name if self.name == other.name else None
@@ -325,8 +321,7 @@ def equals(self, other):
325321
return False
326322
left, right = self._values, other._values
327323
return ((left == right) | (self._isnan & other._isnan)).all()
328-
except TypeError:
329-
# e.g. fails in numpy 1.6 with DatetimeIndex #1681
324+
except (TypeError, ValueError):
330325
return False
331326

332327
def __contains__(self, other):

0 commit comments

Comments
 (0)