使用jupyter notebook

时间:2017-10-06 05:44:49

标签: python jupyter-notebook

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

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

This is the complete traceback

3 个答案:

答案 0 :(得分:1)

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

import xlsxwriter

import pandas as pd

from pandas import DataFrame

path = ('...\\filename.xlsx')

xl = pd.ExcelFile(path)

print(xl.sheet_names)

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

df1 = xl.parse('Sheet1')

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

答案 1 :(得分:0)

import pandas as pd
wb = pd.ExcelFile('D:\\<Excel File Name>.xlsx')
ds = wb.parse('<Sheet  Name>')
print(ds)

答案 2 :(得分:0)

同样的局面,但这对我有用。

import pandas as pd

df = pd.read_excel (r'C:\Users\(NAME)\Desktop\(FILENAME).xlsx')
print (df)