Relative Content

Tag Archive for pandas

Not All Values in Dataset getting Replaced

I was working with a dataset where categorization for Education an individual was categorized by number (e.g. 3 for an associate degree). For easier categorization, I decided to change each number to what it actually represents. To do so, I am using the replace function in pandas. However, I have noticed that it is not consistent with replacement. It replaced the 0 and 1 for males and females but failed to do so for all education levels. I have attached my code below and would appreciate any help. `# Rename columns for clarity
dataset_clean2 = dataset_clean.rename({“D4″:”EDUCATION”, “D5RANGE” : “AGE”}, axis=’columns’)