Guided Project: Clean And Analyze Employee Exit Surveys - help!

Hello, I’m trying to update the values of a dataframe with the following code. It works but gives a SettingWithCopyWarning which I can’t get rid of.

columns = ['Contributing Factors. Dissatisfaction', 'Contributing Factors. Job Dissatisfaction']
tafe_resignations[columns] = tafe_resignations[columns].applymap(update_vals)

If somebody could help me to stop this warning I’d be very grateful!

Hi @austinbooth

Welcome to our Dataquest Community.

Take a look on the below post, it will help you to clear your doubt regarding “SettingWithCopyWarning”.

Thanks but that doesn’t really help. I’ve reviewed the DQ article as well, but I can’t see how it helps in this instance. There wasn’t a solution in that thread either.

Can you share the screenshot of the cell with the error you are getting @austinbooth .

It’s better to share the notebook. Notebooks tend to be very dependent on the surrounding context which a screenshot can’t capture.

1 Like

Here’s the notebook file. The code works, just in a few places I get the warning which is annoying, but I’ve verified that the warnings are false positives.

Basics (1).ipynb (122.4 KB)

1 Like

You have to use a copy method at the time of parsing the ‘seperationtype’ from dataframe.


Brilliant that works, thanks! I didn’t bother putting .copy() on those lines because I didn’t get the warning for those cells. I didn’t realise it could produce the warning further on in the workflow. So that’s been very useful.

Many thanks

1 Like