I am trying to convert string values in a column to binary values.For example in the below table - the mapping will be like this {'cinema':0, 'education':1}.
I have defined a small function as below -
def numconv(a):
return a.map({'education' : 1,'cinema' : 0})
and then I have used 'apply' function to update the values in the dataframe -
train_docs['Class'] = train_docs['Class'].apply(numconv)
But I am getting error as below -
What I am doing wrng here?It should work as per my understanding.