Joy
Joy

Reputation: 9

whats the meaning of this 'Data Frame' object is not callable'

I want to create a hist graph with these numerical columns, but I don't know why I keep getting this error "TypeError: 'DataFrame' object is not callable"

df_num = train_df[['Age', 'SibSp', 'Parch', 'Fare']]
df_num.head()

for i in df_num.columns:
    
    plt.hist(df_num(i))
    plt.title(i)
    plt.show()

Upvotes: 0

Views: 114

Answers (1)

MattDMo
MattDMo

Reputation: 102902

df_num(i) is attempting to call a function df_num with the argument i. You want df_num[i] instead.

Upvotes: 2

Related Questions