Let a DataFrame which have among other two categorical variables one has child young mature old classes and other has male female classes.
How could I have systematically a new column 'Sex_Age' with classes male_child, female_child, male_young, female_young, male_mature, female_mature, male_old, female_old?
In two cases:
I don't want this new categorical variable really added to my DataFrame but only want use it's concept and say, draw
jitter plotwhich have eight bunch of points.I want to add this new categorical variable to my DataFrame.
import pandas as pd
df = pd.DataFrame({'Sex':['male', 'female',\
'male', 'male', 'male', 'female', 'male',\
'male', 'female'], 'Age':['child', 'old', 'mature',\
'young', 'young', 'mature', 'child', 'child', 'child'],
'HairLength':[2,30,8,15,9,35,3,5,6]})
df
In case 1: I want jitter plot of 'HairLength' by 8 bunch in one figure corresponding to 8 cases: male_child, female_mature, ... and I'm not interested in the new column.
In case 2: I'm interested in adding a 'Sex_Age' column to my DateFrame with true data such as male_child and so on.