With pd.DataFrame.replace
, I have been trying to figure out why the values that I replaced revert back to their original values when I replace another set in another column. How can you make the replacements permanent, below?
titanic.replace({'Pclass' :
{3 : 'Lower Class',
2 : 'Middle Class',
1: 'Upper Class'}})