【发布时间】:2022-01-02 11:03:13
【问题描述】:
如何才能消除此警告?
C:\ProgramData\Anaconda3\lib\site-packages\seaborn_decorators.py:36:FutureWarning:将以下变量作为关键字 arg 传递:x。从版本 0.12 开始,唯一有效的位置参数将是 data,并且在没有显式关键字的情况下传递其他参数将导致错误或误解。
警告.warn(enter image description here
sns.countplot(ex_emp['dept'])
plt.title('Department of Employees Who Left')
plt.figure(figsize=(10,5))
plt.savefig('ex_dept.png', bbox_inches='tight')
plt.show()
【问题讨论】:
-
警告告诉你在未来的 seaborn 版本中你需要写
sns.countplot(x=ex_emp['dept'])。我们鼓励你现在已经这样做了。如果没有正确的关键字,它很快就会混淆想要哪个情节。