TypeError: 'DataFrame' object is not calla

2020-03-31 02:13发布

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)

my dataset as follows

enter image description here

but when i run the code i get

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

As a begginer i can't find a solution for this if anyone can help on this very much appreciated.

thanks.

2条回答
劳资没心,怎么记你
2楼-- · 2020-03-31 02:45

You should create an intermediate 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)
查看更多
姐就是有狂的资本
3楼-- · 2020-03-31 02:46

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)

it should be

sns.pairplot(frame[num_cols],size=2)
查看更多
登录 后发表回答