类型错误:distplot() 得到了一个意外的关键字参数“x”(或“色调”)

cal*_*ant 6 data-visualization seaborn

当我尝试绘制此图时出现错误-

sns.distplot(X_train, x='Age')                   #Age is a feature in X_train
Run Code Online (Sandbox Code Playgroud)

当我尝试hue在其中添加参数时出现类似错误

sns.distplot(X_train['Age'], hue=y_train)

TypeError: distplot() got an unexpected keyword argument 'hue'
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?这是我尝试代码的地方 -

https://seaborn.pydata.org/tutorial/distributions.html

cal*_*ant 10

如果有人遇到同样的问题,这就是导致混淆的原因。谢谢@user2864740

sns.distplot() 已弃用。

sns.displot()是带有huex参数的新函数。

如果您收到此错误,请更新您的 seaborn 版本。在 cmd -

pip install seaborn --upgrade
Run Code Online (Sandbox Code Playgroud)

在笔记本中,添加一个 ! 点之前