-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fixed check _is_unorderable_exception
#17724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: fixed check _is_unorderable_exception
#17724
Conversation
pandas/core/dtypes/common.py
Outdated
@@ -1158,7 +1158,9 @@ def _is_unorderable_exception(e): | |||
""" | |||
|
|||
if PY36: | |||
return "'>' not supported between instances of" in str(e) | |||
str_e = str(e) | |||
return "'>' not supported between instances of" in str_e or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parenthesized multi-line strings are preferred in this codebase over slashes.
9e21a58
to
02d3516
Compare
Hello @oleksandr-pavlyk! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on October 01, 2017 at 13:04 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #17724 +/- ##
==========================================
- Coverage 91.27% 91.25% -0.03%
==========================================
Files 163 163
Lines 49766 49766
==========================================
- Hits 45422 45412 -10
- Misses 4344 4354 +10
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17724 +/- ##
==========================================
- Coverage 91.27% 91.25% -0.03%
==========================================
Files 163 163
Lines 49766 49766
==========================================
- Hits 45422 45412 -10
- Misses 4344 4354 +10
Continue to review full report at Codecov.
|
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 pandas-devGH-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() ```
02d3516
to
855d03f
Compare
can you point to something specific which is actually failing with a minimal env.. We tests vs numpy master and this doesn't come up. |
this issue you are referncing: #17051 is already been merged a while back |
@jreback Yes, the #17051 has merged, I was simply pointing to the similar problem. That PR was dealing with a fall-out from the same change in the different tests. To reproduce this problem it is important to use numpy 1.13.2 or 1.13.3 while running the test. Note that Travis uses NumPy 1.13.1 for testing, since miniconda does not ship NumPy 1.13.2 yet. |
@oleksandr-pavlyk you would have to prove that this doesn't work as we already test on the CI with numpy 1.13.3: https://travis-ci.org/pandas-dev/pandas/jobs/282520540 (this is an all conda-forge build), and with numpy master: https://travis-ci.org/pandas-dev/pandas/jobs/282520544 our other builds use defaults for the base build. both of which pass. sure the currently *released *version (IOW 0.20.3) would fail with 1.13.2 on these tests, but that's not relevant). |
Yes, my fix was developed with 0.20.3 in mind. Regarding your comment as to the relevancy. It is relevant for Python distributors, like Anaconda, or Intel Distribution for Python, as customers generally expect distributions to have up-to-date packages. |
closing, this is already fixed in master.
not what I meant. we don't backport from major releases. you can get 0.21.0 when it is out. |
Reference: 1. pandas-dev#17724 2. pandas-dev#17046 Gbp-Dch: Short
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 both of these.
See GH-17046 for discussion.
This caused failing
test test_basic_indexing
when running tests with NumPy 1.13.2.Here is the reproducer