This is a test version of Biostars. For the public version, visit https://www.biostars.org.
TypeError: 'list' object is not callable

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

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

0 answers

No answers yet.

Log in to answer this question.