Рассмотрите возможность создания словаря, который вы можете использовать для переназначения ваших значений. Затем используйте горячую кодировку.
import pandas as pd
df = pd.DataFrame([ ['USA', 3, 'M'], ['USA', 5, 'F'], ['USA', 10, 'F'],
['Canada', 0, 'M'],['Canada', 1, 'M'], ['Canada', 9, 'F'],
['Mexico', 13, 'M'],['Mexico', 18, 'F']], columns = ['Country', 'Age', 'Gender'])
remap_dct = { 0: "Under 1",
1: "1-2yrs",
2: "1-2yrs",
3: "3-4yrs",
4: "3-4yrs",
5: "5-12yrs",
6: "5-12yrs",
7: "5-12yrs",
8: "5-12yrs",
9: "5-12yrs",
10: "5-12yrs",
11: "5-12yrs",
12: "5-12yrs",
13: "13-17yrs",
14: "13-17yrs",
15: "13-17yrs",
16: "13-17yrs",
17: "13-17yrs"}
df['AgeGroup'] = df['Age'].map(remap_dct)
df.loc[df['Age'] >= 18, 'AgeGroup'] = "18 & older"
df = df.join(pd.get_dummies(df['AgeGroup']))
df = df.drop('AgeGroup', axis=1)
print(df)
Country Age Gender 1-2yrs 13-17yrs 18 & older 3-4yrs 5-12yrs Under 1
0 USA 3 M 0 0 0 1 0 0
1 USA 5 F 0 0 0 0 1 0
2 USA 10 F 0 0 0 0 1 0
3 Canada 0 M 0 0 0 0 0 1
4 Canada 1 M 1 0 0 0 0 0
5 Canada 9 F 0 0 0 0 1 0
6 Mexico 13 M 0 1 0 0 0 0
7 Mexico 18 F 0 0 1 0 0 0