读取excel的时候,需要将float转为str,代码如下:
country_df = pd.read_excel('data0818/A_DATA.xls', dtype=str)
print(country_df.to_json(orient="records"))
这篇博客介绍了在Python中使用pandas库读取Excel文件时,如何将数据列的float类型转换为str类型,以便于数据处理。示例代码中展示了通过`pd.read_excel`函数的`dtype`参数设定数据类型,确保所有数据被读取为字符串。
读取excel的时候,需要将float转为str,代码如下:
country_df = pd.read_excel('data0818/A_DATA.xls', dtype=str)
print(country_df.to_json(orient="records"))
2万+
5万+
995

被折叠的 条评论
为什么被折叠?