TypeError:使用seaborn pairplot时,"DataFrame"对象不是可调用错误? [英] TypeError: 'DataFrame' object is not callable error when using seaborn pairplot ?
问题描述
我是python和机器学习的新手,尝试学习该主题,我正在学习在线课程, 我已经在jupyter笔记本中导入了数据集,并尝试在其上执行以下python脚本
i'm new to python and machine learning and try to learn the subject , i'm following an online course , i have imported a dataset in jupyter notebook and try to execute following python script on it
#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)
我的数据集如下
但是当我运行代码时我得到了
but when i run the code i get
TypeError跟踪(最近一次通话最近) 在 () 4进口seaborn as sns 5 num_cols = [年龄",身高",体重",持续时间",心率",身体体温",卡路里"] ----> 6个sns.pairplot(frame(num_cols),size = 2)
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"对象不可调用
TypeError: 'DataFrame' object is not callable
作为初学者,如果有人可以为此提供帮助,我将找不到解决方案 非常感谢.
As a begginer i can't find a solution for this if anyone can help on this very much appreciated.
谢谢.
推荐答案
我发现了问题,并认为这对初学者来说很有帮助,因为我错过了
i have found the issue , and thought this will help for a beginner i have missed square brackets in
sns.pairplot(frame(num_cols),size=2)
应该是
sns.pairplot(frame[num_cols],size=2)
这篇关于TypeError:使用seaborn pairplot时,"DataFrame"对象不是可调用错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!