Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用jupyter笔记本读取xlsx文件_Python_Jupyter Notebook - Fatal编程技术网

Python 使用jupyter笔记本读取xlsx文件

Python 使用jupyter笔记本读取xlsx文件,python,jupyter-notebook,Python,Jupyter Notebook,我曾尝试使用jupyter笔记本读取存储在系统中的xlsx文件。我已从文件所在的当前目录运行了jupyter笔记本。但它显示错误为“模块未找到错误” 下面的代码应该能够访问/读取您的excel文件 import pandas as pd path = ('...\\filename.xlsx') xl = pd.ExcelFile(path) print(xl.sheet_names) 上面的命令显示xlsx文件中的图纸 df1 = xl.parse('Sheet1') 上面的命令解析所需

我曾尝试使用jupyter笔记本读取存储在系统中的xlsx文件。我已从文件所在的当前目录运行了jupyter笔记本。但它显示错误为“模块未找到错误”


下面的代码应该能够访问/读取您的excel文件

import pandas as pd
path = ('...\\filename.xlsx')
xl = pd.ExcelFile(path)
print(xl.sheet_names)
上面的命令显示xlsx文件中的图纸

df1 = xl.parse('Sheet1')
上面的命令解析所需的工作表

作为pd导入
import pandas as pd
wb = pd.ExcelFile('D:\\<Excel File Name>.xlsx')
ds = wb.parse('<Sheet  Name>')
print(ds)
wb=pd.ExcelFile('D:\\.xlsx') ds=wb.parse(“”) 打印(ds)
同样的结果,但这一个对我有效

import pandas as pd

df = pd.read_excel (r'C:\Users\(NAME)\Desktop\(FILENAME).xlsx')
print (df)
*您必须将.xlsx文件导入Jupyter笔记本文件。。。 *您还可以将其导入Github存储库并获取原始文件,然后将其复制并粘贴到显示“file_name.xlsx”的位置


[原始文件URL示例

向我们展示了完整的回溯。此外,您似乎没有安装包。csv文件正在正确读取。除xlsx之外,所有其他格式都工作正常。读取xlsx文件我必须安装什么包???
xlrd
是熊猫的一项要求。请尝试
pip install xlrd
您需要什么包目前正在使用?如果您愿意,请使用xlrd作为xlsx或pandas。在我安装了xlrd.thanq@Ketan Mukadam和其他软件之后,它就可以工作了
import pandas as pd
df = pd.read_excel('file_name.xlsx', 'Sheet1')
df