我有一个关于将xlsx文件导入Python的基本问题。我已经检查了许多关于同一主题的回复,但是我仍然无法将我的文件导入Python,无论我尝试什么。这里是我的代码和错误我收到:将excel文件导入python
import pandas as pd
import xlrd
file_location = 'C:\Users\cagdak\Desktop\python_self_learning\Coursera\sample_data.xlsx'
workbook = xlrd.open_workbook(file_location)
错误:
IOError: [Errno 2] No such file or directory: 'C:\\Users\\cagdak\\Desktop\\python_self_learning\\Coursera\\sample_data.xlsx'
你的问题是,该文件是找不到,不是导入问题:验证文件处于您认为处于的位置。 – boardrider
提示:您是否确认该位置存在xlsx文件? – karthikr
是的,它的确如此。我在这里复制文件夹路径:C:\ Users \ cagdak \ Desktop \ python_self_learning \ Coursera和excel文件的名称是:sample_data –