且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python:使用 xlrd 从 excel 中读取百分比值

更新时间:2023-02-18 16:19:42

你可以使用 pandas 将整个 excel 转换为数据框,例如:

You could use pandas to convert the whole excel to a data frame, something like:

excel_dataframe = pd.read_excel(excel_file, sheet_name=s)

然后使用应用映射转换为字符串.

and then use a apply map to convert to string.

 excel_dataframe = excel_dataframe.applymap(str)

这会将excel中的所有单元格转换为字符串,这样您就可以获得一个字符串对象和正确的值

This will convert all the cells in the excel to string, that way you get a string object and the correct value