【发布时间】:2018-02-15 16:26:49
【问题描述】:
在将 excel 文件导入 pandas 时,我收到“FileNotFoundError: [Errno 2] No such file or directory: 'census_data.xlsx'”。我仔细检查了我的文件是否正确,但仍然出现此错误。
这是我的代码:
import xlrd
book = xlrd.open_workbook('census_data.xlsx')
for sheet in book.sheets():
print (sheet.name)
【问题讨论】:
-
for sheet in book.sheets(): -
由于我不能关闭主题,我将关闭作为一个解释如何正确执行它的骗子。使用标记的欺骗中的任何答案。老实说,通过阅读语法错误返回的消息,不难理解问题的根源。