You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用sns.jointplot触发TypeError:位置参数传入数量不符合要求

解决sns.jointplot()的TypeError问题

错误原因

新版Seaborn的jointplot()已不再支持直接传入两个位置参数(旧版本允许sns.jointplot(data_col1, data_col2)这类写法),必须显式通过关键字参数指定x和y,否则会触发参数数量不匹配的TypeError。

修正后的代码

有两种可行的修正方式:

  1. 直接指定x、y参数为对应的数据列:
plt.figure(figsize=(15,10))
sns.jointplot(x=data.radius_mean, y=data.area_mean, kind="reg")
plt.show()
  1. 结合data参数,传入列名的字符串:
plt.figure(figsize=(15,10))
sns.jointplot(x="radius_mean", y="area_mean", data=data, kind="reg")
plt.show()

内容的提问来源于stack exchange,提问作者Ngeteh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 03:47:01