Home > OS >  data = pandas.read_excel('filename.xlsx' doesn't work. Get an error: AttributeError:
data = pandas.read_excel('filename.xlsx' doesn't work. Get an error: AttributeError:

Time:11-05

import pandas
name = 'filename.xlsx'
data = pandas.read_excel(name)
print(data)  

Im trying to open an excel file using pandas, but I get the error:

AttributeError: partially initialized module 'pandas' has no attribute 'read_excel' (most likely due to a circular import)

What could be the problem, as it isn't the code, because it was working on a different computer.

CodePudding user response:

That's maybe because you're working on another directory. Try to add your file path to your file name:

name = your_file_path   'filename.xlsx'
data = pandas.read_excel(name)

CodePudding user response:

Found the issue. I just forgot to pip install openpyxl

  • Related