Skip to content

Commit 9e21a58

Browse files
BUG: fixed check _is_unorderable_exception
With upgrade to NumPy 1.13.2 the error message raised when comparing unorderable types changes from using "'>' not supported between instances of" to using "'<' not supported between instances of". This PR checks of these. See GH-17046 for discussion. This caused failing test test_basic_indexing. Here is the reproducer ``` import pandas import pytest import numpy as np def test_basic_indexing(): s = pandas.Series(np.random.randn(5), index=['a', 'b', 'a', 'a', 'b']) pytest.raises(IndexError, s.__getitem__, 5) pytest.raises(IndexError, s.__setitem__, 5, 0) pytest.raises(KeyError, s.__getitem__, 'c') s = s.sort_index() pytest.raises(IndexError, s.__getitem__, 5) pytest.raises(IndexError, s.__setitem__, 5, 0) # this part was failing test_basic_indexing() ```
1 parent 57befd1 commit 9e21a58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/dtypes/common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,9 @@ def _is_unorderable_exception(e):
11581158
"""
11591159

11601160
if PY36:
1161-
return "'>' not supported between instances of" in str(e)
1161+
str_e = str(e)
1162+
return "'>' not supported between instances of" in str_e or \
1163+
"'<' not supported between instances of" in str_e
11621164

11631165
elif PY3:
11641166
return 'unorderable' in str(e)

0 commit comments

Comments
 (0)