Description
-
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