-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: Better error message for missing matplotlib #20538
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
ERR: Better error message for missing matplotlib #20538
Conversation
dd1f1ac
to
1159a75
Compare
Codecov Report
@@ Coverage Diff @@
## master #20538 +/- ##
==========================================
+ Coverage 91.81% 91.84% +0.02%
==========================================
Files 152 153 +1
Lines 49259 49265 +6
==========================================
+ Hits 45229 45245 +16
+ Misses 4030 4020 -10
Continue to review full report at Codecov.
|
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.
Looks good!
pandas/util/_test_decorators.py
Outdated
@@ -160,6 +160,8 @@ def decorated_func(func): | |||
|
|||
skip_if_no_mpl = pytest.mark.skipif(_skip_if_no_mpl(), | |||
reason="Missing matplotlib dependency") | |||
skip_if_mpl = pytest.mark.skipif(not _skip_if_no_mpl(), | |||
reason="matplotlib is pressent") |
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.
Do we have a test build that does not have matplotlib ?
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.
pressent --> present
doc/source/whatsnew/v0.23.0.txt
Outdated
@@ -958,6 +958,7 @@ Offsets | |||
|
|||
Numeric | |||
^^^^^^^ | |||
- Better error message when attempting to plot but matplotlib is not installed (:issue:`19810`). |
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.
move to Plotting section
[ci skip]
https://travis-ci.org/pandas-dev/pandas/jobs/360014203 doesn't include matplotlib, and should have run this. |
@@ -17,6 +17,14 @@ | |||
from pandas.tests.plotting.common import TestPlotBase, _check_plot_works | |||
|
|||
|
|||
@td.skip_if_mpl | |||
def test_import_error_message(): |
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.
Let's reference the issue number here.
pandas/plotting/_core.py
Outdated
@@ -97,6 +98,9 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=None, | |||
secondary_y=False, colormap=None, | |||
table=False, layout=None, **kwds): | |||
|
|||
if not _HAS_MPL: | |||
raise ImportError("matplotlib is required for plotting.") |
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.
Can we just write a separate function for this check? You use this same code 4 times.
Closes #19810