I am looking for a better way to replace all column values with some other value.
What I currently have is this:
gender_text = ['undefined', 'male', 'female']
df.loc[df['gender'] == 0, 'gender'] = gender_text[0]
df.loc[df['gender'] == 1, 'gender'] = gender_text[1]
df.loc[df['gender'] == 2, 'gender'] = gender_text[2]
df.head()
I was hoping for something a bit more elegant and use the gender value (0, 1 or 2) as the index to choose from in gender_text to have everything fit in one line.