Looking to split a df | series column into 2 parts based on the first "_"
example in column:
Male_85__and_over
test['gender'] = test['column_Name_pivoted'].str.split('_').str[0]
test['age'] = test['column_Name_pivoted'].str.split('_',n=1).str[1:]
Output is not what I was looking for:
| gender | age |
|---|---|
| Male | [85__and_over] |
You could use
str.extracthere: