TypeError: 'list' object is not callable
0
0
Entering edit mode
20 months ago
Jakpa ▴ 50

HI,

I recently start having error with the code below. Meanwhile, I have been running this code for the past 2weeks without error.

from sklearn.feature_selection import mutual_info_classif
from sklearn.feature_selection import SelectKBest

X = data.drop('BlcaGrade',axis=1)
y = data['BlcaGrade']

mutual_info = mutual_info_classif(X, y)
mutual_info = pd.Series(mutual_info)
best_cols = SelectKBest(mutual_info_classif, k=100)
best_cols.fit(X, y)
print((X.columns[best_cols.get_support()]))

reducedFeatures = pd.DataFrame(X.columns[best_cols.get_support()])
reducedFeatures.to_csv("ReducedFeatures.csv")`

selectedFeatures = list(X.columns[best_cols.get_support()])

This is the error massage:

error massage

I tried to to modify ( ) to [ ] but it did not solve the problem. Also there was no previous code where I assigned list as a variable name.

how can I resolve this problem?

List dataFrame python • 715 views
ADD COMMENT
0
Entering edit mode

I doubt this will fix your problem, but you have an apostrophe after your reducedFeatures.to_csv() line that could cause syntax errors

ADD REPLY

Login before adding your answer.

Traffic: 2152 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6