-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
FIX: fix cleanup warnings for errorbar timeseries #36982
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
FIX: fix cleanup warnings for errorbar timeseries #36982
Conversation
so the test itself was causing the warnings? |
Yes, the test itself was causing the warning. |
this reminds me of this #13188 issue, the warning and the issue looks the same, should we use with tm.assert_produces_warning(UserWarning):
axes = _check_plot_works(tdf.plot, kind=kind, yerr=tdf_err, subplots=True)
self._check_has_errorbars(axes, xerr=0, yerr=1) |
I did not use |
true, I would suggest to use does it sound good to you? |
Absolutely, I will refactor to |
yep! sounds good! you could use use
yeah, a follow-up would be great! |
As agreed with charlesdong1991, use assert_produces_warning and leave a comment on which warning message is emitted
Extract test_errorbar_plot_different_kinds from test_errorbar_plot and parametrize it.
8501cd3
to
d5a9e5e
Compare
Did that. But also I decided to move from |
sure! |
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.
very nice!
could you double check that after this change, the warnings you post in the PR description are gone?
cc @jreback
pandas/tests/plotting/test_frame.py
Outdated
_check_plot_works(tdf.plot, kind=kind, yerr=tdf_err, subplots=True) | ||
fig = plt.gcf() | ||
axes = fig.get_axes() | ||
for ax in axes: |
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.
sorry, just noticed this, a minor question:
i think with tm.assert_produce_warning
, we could still use the current way to check errorbars, right? _check_has_errorbars
i recall can take in axes/list-like
input.
axes = _check_plot_works(
tdf.plot, kind=kind, yerr=tdf_err, subplots=True
)
self._check_has_errorbars(axes, xerr=0, yerr=1)
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.
Oh, yes, it does accept list-like. I will change to the original implementation.
I checked.
Another warning is handled in #36981 |
thanks @ivanovmg |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Currently in
pandas/tests/plotting/tests_frame.py
there are several warnings emitted.This PR handles warnings in
test_errorbar_timeseries
.If this approach is considered reasonable by the reviewers, then I will do the same for
test_errorbar_plot
as well as other similar warnings among the plotting-related tests.