python - 使用jupyter笔记本读取xlsx文件

标签 python jupyter-notebook

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

This is the image of the code i have written and also the error i got

This is the complete traceback

最佳答案

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

import pandas as pd
path = ('...\\filename.xlsx')
xl = pd.ExcelFile(path)
print(xl.sheet_names)

上面的命令显示 xlsx 文件中的工作表

df1 = xl.parse('Sheet1')

以上命令解析所需的工作表

关于python - 使用jupyter笔记本读取xlsx文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46599016/

相关文章:

python - 在Python中的其他模块之间共享一个模块

python - Django 模块未找到错误

python - Jupyter 笔记本内核错误 - FileNotFoundError : [WinError 2]

python - 如何使用不同的系列在 python 中制作数据框?

python - 使用交互设置 slider 的默认值

python - 从 Python 发布时订阅不起作用

python 环境区分大小写 - os.environ[...]

python - 比较时超过最大递归深度

r - %Rpush >> 复杂对象列表(例如 IPython Notebook 中的 pandas DataFrames)

python - 为什么我的 jupyter 内核在导入 numpy 时在虚拟环境中运行失败?