简体   繁体   English

使用boxplot()时如何抑制警告?

[英]How to suppress warnings when using boxplot()?

When I use the boxplot(), I get 2 warnings. 当我使用boxplot()时,收到2条警告。 The chart is displayed correctly, but 2 warnings appear. 图表正确显示,但是出现2条警告。 Here is my code: 这是我的代码:

import pandas as pd
pd.options.display.mpl_style = 'default'
df.boxplot()

Here are the 2 warnings. 这是2条警告。

Warning 1: 警告1:

  /home/nbuser/anaconda3_501/lib/python3.6/site-packages/IPython/core/ interactiveshell.py:2910: FutureWarning:


mpl_style had been deprecated and will be removed in a future version.
Use `matplotlib.pyplot.style.use` instead.

Warning 2: 警告2:

 /home/nbuser/anaconda3_501/lib/python3.6/site-packages/matplotlib/ font_manager.py:1320: UserWarning:

    findfont: Font family ['monospace'] not found. Falling back to DejaVu Sans

Is there anything I can do to suppress these 2 warning? 我有什么办法可以抑制这两个警告?

Use 采用

matplotlib.style.use('ggplot') 

instead of 代替

pd.options.display.mpl_style = 'default'

Please import the matplotlib package before calling this. 请在调用此之前导入matplotlib软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM