Pandas Column Content Editing


I was wondering what method is best for changing contents in the whole column in my dataframe.
Part of my dataframe has the column "Percentage" and the contents in that column labeled as "#%". Here, I want to adjust the whole column from percentage to decimal numbers. For instance, 80% to 0.80 and 42% to 0.42. What would be the best way to make this adjustment?

Thanks in advance.

Asked By: python noobie



df['DataFrame Column'] = df['DataFrame Column'].str[:-1].astype(float)/100
Answered By: Iddo Sadeh
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.