gpt4 book ai didi

python - 类型错误 : 'DataFrame' object is not callable error when using seaborn pairplot ?

转载 作者:行者123 更新时间:2023-11-30 09:06:56 28 4
gpt4 key购买 nike

我是 python 和机器学习的新手,并尝试学习该主题,我正在学习在线类(class),我已经在 jupyter 笔记本中导入了一个数据集,并尝试在其上执行以下 python 脚本

#creating a scatter plot matrix
%matplotlib inline

import seaborn as sns
num_cols = ["Age","Height","Weight","Duration","Heart_Rate","Body_Temp","Calories"]
sns.pairplot(frame(num_cols),size=2)

我的数据集如下

enter image description here

但是当我运行代码时我得到

TypeError Traceback (most recent call last) in () 4 import seaborn as sns 5 num_cols = ["Age","Height","Weight","Duration","Heart_Rate","Body_Temp","Calories"] ----> 6 sns.pairplot(frame(num_cols),size=2)

TypeError: 'DataFrame' object is not callable

作为初学者,如果有人可以提供帮助,我找不到解决方案 非常感谢。

谢谢。

最佳答案

您应该创建一个中间 DataFrame:

import pandas as pd

%matplotlib inline

import seaborn as sns
num_cols = ["Age","Height","Weight","Duration","Heart_Rate","Body_Temp","Calories"]
df = pd.DataFrame(columns=num_cols)
sns.pairplot(df,size=2)

关于python - 类型错误 : 'DataFrame' object is not callable error when using seaborn pairplot ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49680331/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com