当我使用datalab进行绘图时,我会不断收到有关字体的警告。它实际上使绘制效果很好,但是每次都会出现。我该如何摆脱呢?

df.plot();


  /usr/local/envs/py3env/lib/python3.5/site-packages/matplotlib/font_manager.py:1320:
  UserWarning:findfont:找不到字体家族['sans-serif']。坠落
  回到DejaVu Sans(prop.get_family(),
  self.defaultFamily [fontext]))

最佳答案

VictorGGI解决方案对我而言不起作用,因为该文件始终返回到其先前状态(也许在datalab重新启动时重置了?)。无论如何,更简单的解决方案是使用以下命令隐藏警告:

import warnings
warnings.filterwarnings("ignore")

关于python - 绘图时的Google Datalab警告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49957874/

10-11 09:32