Guided Project: Clean And Analyze Employee Exit Surveys,[Step 5]


My Code:

dete_resignations[‘cease_date’] = pd.to_numeric(dete_resignations[‘cease_date’].str.extract(r’([1-2][0-9]{3})’,expand = False))

What I expected to happen: The ‘cease_date’ column be updated without warning.

What actually happened:

There is a problem with this part of the code to the rest. For the next step when I tried to write:

dete_resignations[‘institute_service’] = dete_resignations[‘cease_date’]-dete_resignations[‘dete_start_date’]

again I received the previous warning.

This has been clarified on Step 4 -

In this step, note that you may see what is known as a SettingWithCopy Warning. This won’t prevent your code from running properly but it’s just letting you know that whatever operation you’re doing is trying to be set on a copy of a slice from a dataframe. We’ll include instructions below to get around this.

And in the instructions

Use the DataFrame.copy() method on the result to avoid the SettingWithCopy Warning.

That particular Warning, SettingWithCopy, is expected. You will have to add the copy() method to avoid it as the above instruction points out.

Thank you. I didn’t notice to that part of step 4. It helped.

1 Like

It works perfectly, I also had not followed the instructions in step 4 to the book and kept running into the same error. Thank you @the_doctor and @ aminzahedi7386

1 Like