问题
I have a dataframe of surgical activity data that has 58 columns and 200,000 records. One of the columns is treatment specialty. Each row corresponds to a patient encounter. I want to see the relative conribution of medical specialties.One column is 'treatment_specialty'. I have used
df['treatment_specialty'].value_counts(normalize=true)
to get the relative proprtions of each specialty. This below is returned (no errors). The specialties have codes eg 150 is neurosurgery.
df.head()
150 0.642710
150 0.186934
218 0.062673
108 0.048300
218 0.018964
There are 69 records and a lot of the specialties have duplicate entries. Could I have some whitespace in the dataframe or is there another reason why the specialty codes are not unique?
来源:https://stackoverflow.com/questions/60142205/pandas-value-counts-returns-non-unique-values