Prevent pandas read_excel() to divide all percent values by one hundred?

Viewed 253

I was loading an xlsx file with pandas (1.0.5) and noticed that values with a percent sign (e.g. 0.3%) are automatically divided by 100.

I know how to load that column as a string but don't understand why it would divide the value by 100. Ideally, I'd like to have only the float value without the percent sign. For now I stripped the % and cast the columns, but there has to be a better way. This does not happen when loading the data as CSV.

df = pd.read_excel("testfile.xlsx")

input.xlsx :

|alpha|beta|
|:-|:-|
|0.3%|0.34%|

resulting data frame :

|alpha|beta|
|:-|:-|
|0.003|0.0034|
0 Answers
Related