Use dataframe.applymap() to update values in the dataframe

Screen Link:

Hi, I am trying to do the following taks of Guided Project: Clean And Analyze Employee Exit Surveys: " Use the DataFrame.applymap() method to apply the function above to the 'Contributing Factors. Dissatisfaction' and 'Contributing Factors. Job Dissatisfaction' in the tafe_resignations dataframe."

I manage to create a new dataframe with the data, but I do not want how to substitute it in the original frame:

We then create a list of columns to change:

cols = [‘Contributing Factors. Dissatisfaction’, ‘Contributing Factors. Job Dissatisfaction’]

And apply for each column, returning the value to the column

teste = tafe_resignations[cols].applymap(update_vals)

Of course, I could say something like:
tafe_resignations[‘Contributing Factors. Dissatisfaction’] = teste[0]
But I guess there is a better way to do it all in a go, and no column by column?



Try this to create a list of all the columns for further uses:

cols = tafe_resignations.columns.tolist()