简体   繁体   English

无法读取 xls 文件

[英]Can't read xls file

I have used pip install xlrd to read my xls file but when I print the data frame it still returned NaN.我已经使用 pip install xlrd 来读取我的 xls 文件,但是当我打印数据帧时它仍然返回 NaN。 Is there any other setups or packages that I need to install?我需要安装任何其他设置或软件包吗?
1 : https://i.stack.imgur.com/JbAgJ.png 1https://i.stack.imgur.com/JbAgJ.png

Could you please inspect the Xls file.你能检查一下Xls文件吗? Are the cells which are displayed as NaN are blank?显示为 NaN 的单元格是否为空白? It usually happens when the cell is blank.它通常发生在单元格为空白时。 You can use您可以使用

data = data.fillna('')数据 = data.fillna('')

to replace NaN with Blank.用空白替换 NaN。 Read more about here: https://medium.com/swlh/python-guide-to-reading-excel-sheets-9132d81cbedd在此处阅读更多信息: https://medium.com/swlh/python-guide-to-reading-excel-sheets-9132d81cbedd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM