我无法使用ExcelFile()将excel文件加载到数据框中。我导入了熊猫,xlrd和openpyxl。我正在使用spyder进行交互式数据分析。 我是熊猫和蟒蛇的新手,所以我会教一个初学者可以理解的答案。有人能帮助我吗?导入excel文件错误python pandas
>>> import xlrd
>>> import openpyxl
>>> from pandas import *
>>> xls = ExcelFile('C:\RWFC\test.xls')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 1294, in __init__
self.book = xlrd.open_workbook(path_or_buf)
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 400, in open_workbook
f = open(filename, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\\RWFC\test.xls'
尝试使用原始字符串转义您的路径:'xls = ExcelFile(r'C:\ RWFC \ test.xls')'或双反斜杠:'xls = ExcelFile('C:\\ RWFC \\ test。 XLS')'。 – Fenikso