Guided Project: Clean and Analyze Employee Exit Surveys - step 7

Hi folks,

Im a little stuck here. In step 7 (Learn data science with Python and R projects) the instructions tell you to create a new function to convert certain values to True, False and NaN. All good so far. Then it says

’ 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.’

Now I don’t understand this because applymap() can only be applied to a dataframe and not to series, right? So, am I expected to create a new DF off of those two columns and then use applymap? Could anyone help me understand what’s expected here?

Many thanks,

Yes, you are correct! df.applymap() only applies to dataframes. However, since we want to apply our new fancy function that converts values to True or False on two columns of our dataframe, we don’t need to create a new dataframe but rather just take a slice of our existing dataframe, something like:

tafe_resignations[['Contributing Factors. Dissatisfaction', 'Contributing Factors. Job Dissatisfaction']]

which is a dataframe in an of itself which we can then use appplymap() on. Don’t forget to implement df.any() as the Learn section indicates so that we ultimately get the desired result in the newly created column of the dataframe.


Thank you very much, that makes sense!