I have a dataset in which the target variable is False and True but the column is not Boolean in nature rather an object. I have tried these but they don't work:-
df_new['Y_var'] = df_new['Y_var'].map({'True': 1, 'False': 0})
and
df_new['Y_var']=df_new[Y_var'].replace(['False','True'],[0,1])
and
df_new['Y_var'].astype(bool).astype(int)
output of df_new['Y_var'].to_list()
:
[' False.', ' False.', ' False.', ' False.', ' True.', ' False.', ' False.', ' False.', ' False.', ' True.',.....]