I am trying to assigns numbers to the 'Sex' feature in a dataframe. My code is as follows:
df['Sex'] = df['Sex'].replace('male', 1, inplace = True)
df['Sex'] = df['Sex'].replace('female', 2, inplace = True)
However, the code gives as outcome of 'None' in the 'Sex' feature of the dataframe. What could be the problem in this code?