I have a data frame wherein a column is of "object" data type. I use pd.to_numeric() with errors = 'coerce' to convert this to "float" data type. However, the converted column appears as NaN for all entries. If I let errors = 'ignore', none of the entries are converted to float. Is there something I am missing? The following is the code snippet:
pd.to_numeric(df['gender'],errors = 'coerce')
The column df['gender'] comprises 'Male' and 'Female' entries. I would like to convert these to 'float' data type.
Thank you!