Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading xlsx file using jupyter notebook

I have tried to read an xlsx file which is stored in my system using jupyter notebook.I had run the jupyter notebook from the present directory where my file is present.But it is showing an error as "module not found error".

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

This is the complete traceback

like image 295
Akhil Reddy Avatar asked Oct 25 '25 08:10

Akhil Reddy


2 Answers

The below code should able to access /read your excel file

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

The above command shows the sheets in a xlsx file

df1 = xl.parse('Sheet1')

Above command parses the sheet required

like image 104
Hemanth Kocherlakota Avatar answered Oct 28 '25 00:10

Hemanth Kocherlakota


Same outout, but this one worked for me.

import pandas as pd

df = pd.read_excel (r'C:\Users\(NAME)\Desktop\(FILENAME).xlsx')
print (df)
like image 33
Marcell Kovacs Avatar answered Oct 28 '25 00:10

Marcell Kovacs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!