Reputation: 7
ohe = OneHotEncoder(sparse=False)
ohe.fit_transform(file(['Areas of interest']))
I am getting the error:
TypeError: 'DataFrame' object is not callable
Upvotes: 0
Views: 10357
Reputation: 385
As implied by the error message that you get, file
is probably a pandas DataFrame.
Inside fit_transform()
you have written:
file(['Areas of interest'])
while the correct would have been:
file['Areas of interest']
The extra parentheses in the first case cause the error you receive because file
is not a function but a data frame.
You do not call data frames (using parentheses means that you are trying to pass an argument to a function), but you access their contents by indexing them (using square brackets []
with the name of a column as an argument).
Indexing can be done in many other ways. Refer to the pandas user manual for more details.
Upvotes: 2