What I expected to happen:
I would get the counts of values for the separationtype series in dete_survey_updated and tafe_survey_updated. separationtype is in both dataframes.
What actually happened:
Error for dete_survey_updated is IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
Error for tafe_survey_updated is KeyError: 'separationtype'
Hey @vroomvroom , I can’t access the notebook because the link is broken, can you copy paste the entire code instead ? and if possible, can you give me the link to dataset ?
Thanks for replying. For separationtype, I thought that was the error too but in tafe_survey_updated.rename({"Record ID":"id", "CESSATION YEAR":"cease_date", "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"}, axis=1) , the output dataframe includes the separationtype column.
I got another error ‘Cannot specify both ‘axis’ and any of ‘index’ or ‘columns’’ when I set inplace='True and put “columns=” before the list of columns.
dete_survey_updated.columns.str.lower().str.strip().str.replace(’ ‘,’_’) gives the error : AttributeError: ‘Index’ object has no attribute ‘columns’
I figured it out. I needed to set the renaming code equal to tafe_survey_updated. tafe_survey_updated = tafe_survey_updated.rename({"Record ID":"id", "CESSATION YEAR":"cease_date", "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"}, axis=1)