我無法使用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