Skip to content

TST: MatplotlibDeprecationWarning in test related to pie chart #37668

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

Closed
2 of 3 tasks
ivanovmg opened this issue Nov 6, 2020 · 0 comments · Fixed by #37669
Closed
2 of 3 tasks

TST: MatplotlibDeprecationWarning in test related to pie chart #37668

ivanovmg opened this issue Nov 6, 2020 · 0 comments · Fixed by #37669
Assignees
Labels
Testing pandas testing functions or related to the test suite Visualization plotting
Milestone

Comments

@ivanovmg
Copy link
Member

ivanovmg commented Nov 6, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

pytest -Werror pandas/tests/plotting/tests_frame.py::TestDataFramePlots::test_pie_df_nan

Problem description

When testing test_frame.py the following warning is issued:

============================================================================================================= warnings summary =============================================================================================================
pandas/tests/plotting/test_frame.py::TestDataFramePlots::test_pie_df_nan
pandas\plotting\_matplotlib\core.py:1551: MatplotlibDeprecationWarning: normalize=None does not normalize if the sum is less than 1 but this behavior is deprecated since 3.3 until two minor releases later. After the deprecation period the default value will be normalize=True. To prevent normalization pass normalize=False
    results = ax.pie(y, labels=blabels, **kwds)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

This code is the reason for the warnings:

matplotlib/axes/_axes.py
...
    def pie(...):
        ...
        if normalize is None:
            if sx < 1:
                cbook.warn_deprecated(
                    "3.3", message="normalize=None does not normalize "
                    "if the sum is less than 1 but this behavior "
                    "is deprecated since %(since)s until %(removal)s. "
                    "After the deprecation "
                    "period the default value will be normalize=True. "
                    "To prevent normalization pass normalize=False ")
            else:
                normalize = True

Expected Output

No warnings.

Versions

The issue is present starting from matplotlib version 3.3.
Before that normalize kwarg was not applicable to plt.pie.

pd.show_versions()

INSTALLED VERSIONS

commit : 210c06e
python : 3.8.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1251

pandas : 1.2.0.dev0+1079.g210c06e2f
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.4
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.1.1
hypothesis : 5.37.4
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.1
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.4
fastparquet : 0.4.1
gcsfs : 0.7.1
matplotlib : 3.3.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.4.2
scipy : 1.5.0
sqlalchemy : 1.3.20
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.51.2

@ivanovmg ivanovmg added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 6, 2020
@ivanovmg ivanovmg self-assigned this Nov 6, 2020
@ivanovmg ivanovmg changed the title BUG: MatplotlibDeprecationWarning in test related to pie chart TST: MatplotlibDeprecationWarning in test related to pie chart Nov 6, 2020
@charlesdong1991 charlesdong1991 added Testing pandas testing functions or related to the test suite Visualization plotting and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 7, 2020
@charlesdong1991 charlesdong1991 added this to the 1.2 milestone Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants