## Converting range of Age to numeric variable using (target ordinary encodiing)
## Note: Dont map from 0 because of mathematical issue, you should always satart your mapping from 1
df['Age']=df['Age'].map({'0-17':1,
'18-25':2,
'26-35':3,
'36-45':4,
'46-50':5,
'51-55':6,
'55+':7 })
df.head()
#or
## Converting Gender "M" and "F" to numeric variable
## Note: Dont map from 0 because of mathematical issue, you should always satart your mapping from 1
df['Gender']=df['Gender'].map({'F':0, 'M':1})
df.head()