Clean and Analyze Employee Exit Survey (step 4)

Hello @dataquest,

Please help

My Code:

            "Reason for ceasing employment": "separationtype",
            "Gender. What is your Gender?": "gender", "CurrentAge. Current Age": "age",
            "Employment Type.  Employment Type":"employment_status", 
            "Classification.  Classification": "position", 
            "LengthofServiceOverall. Overall Length of Service at Institute (in years)": "institute_service",
            "LengthofServiceCurrent. Length of Service at current workplace (in years)": "role_service"}, inplace=True)

What I expected to happen:
I expected all the column names to be renamed. The Gender. What is your gender?, CurrentAge. CurrentAge, EmploymentType. EmploymentType, Classification. Classification columns do not update.

What actually happened:

I have attached a screenshot

Thank You!

1 Like

You need to make sure that the columns in your code match exactly with the ones in your dataframe to be able to rename them.

For example, it doesn’t seem that the column name is Classification. Classification. From your attached image, it seems there is more spaces between Classification. and Classification. The other columns you are facing issues with also seem to have the same pattern.

You need to make sure the column names match exactly, including those spaces. Instead of typing them out, try to copy-paste them into your dictionary.

1 Like

Thank you @the_doctor for your response.

Prior to posting this, I had tried different options including your suggestion, but nothing seems to work.

I’d keep trying

1 Like