Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: catch warnings from pandas in cbook._check_1d#16347
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
FIX: catch warnings from pandas in cbook._check_1d#16347
Uh oh!
There was an error while loading.Please reload this page.
Conversation
with warnings.catch_warnings() as w: | ||
warnings.filterwarnings("ignore", | ||
category=DeprecationWarning, | ||
module='pandas[.*]') |
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.
does this mean we're just kicking the can down the road and will need yet another fix when pandas actually change this behavior?
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.
The change will be to raise one of the Exceptions we already catch below so we will still be happy.
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.
fair enough
If we catch the warning or the exception, we need to cast to numpybecause later on in `_plot_args` we again use multi-dimensionalindexing to up-cast to a 2D array.closesmatplotlib#16295
ae4354c
toc7eddd6
Compare@bashtage However on older versions we are not getting back a numpy array In [1]:importpandasaspdIn [2]:d=pd.Series([])In [3]:d.index[:,None]Out[3]:Int64Index([],dtype='int64')In [4]:type(d.index[:,None])Out[4]:pandas.core.indexes.numeric.Int64IndexIn [5]:d.index[:,None].ndimOut[5]:1In [6]:pd.__version__Out[6]:'0.25.1' |
lib/matplotlib/cbook/__init__.py Outdated
# was an unintentional quirk of pandas the above line will raise | ||
# an exception in the future. |
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.
since the above line is getting deleted, this comment is no longer relevant.
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.
It is still relevant, the line above was moved down and put inside the context manager below.
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.
Ok, then it should be changed to "the line below" or moved to be next to the line it's referring to:
ndim=x[:,None].ndim#will raise exception in future
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free tosuggest an improvement. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free tosuggest an improvement. |
…k._check_1dMerge pull requestmatplotlib#16347 from tacaswell/fix_pandas_index_deprecationFIX: catch warnings from pandas in cbook._check_1d Conflicts:lib/matplotlib/tests/test_axes.py - new test in middle of section of tests not on v2.2.x yet, only kept new test
…k._check_1dMerge pull requestmatplotlib#16347 from tacaswell/fix_pandas_index_deprecationFIX: catch warnings from pandas in cbook._check_1d
…347-on-v3.2.xBackport PR#16347 on branch v3.2.x (FIX: catch warnings from pandas in cbook._check_1d)
…-v3.1.xBackport PR#16347: FIX: catch warnings from pandas in cbook._check_1d
…-v2.2.xBackport PR#16347: FIX: catch warnings from pandas in cbook._check_1d
So, |
I guess because pandas 1.0 is out? |
I actually don't understand. The warning is from pandas 1.0 (old pandas pass this test) and the result is:
So somehow we are no longer capturing the warning. |
Uh oh!
There was an error while loading.Please reload this page.
If we catch the warning or the exception, we need to cast to numpy
because later on in
_plot_args
we again use multi-dimensionalindexing to up-cast to a 2D array.
closes#16295
PR Summary
PR Checklist