-1

I am quite new to Python, so I don't know how to fix following problem. I was using this code:


df = pd.read_excel(r'C:\Users\myname\Documents\email.xlsx')
print(df)

but when I executed the command I recieved the following: AttributeError: partially initialized module 'pandas' has no attribute 'read_excel' (most likely due to a circular import)

Also, it said something about numpy earlier too. Anybody know how to help me?

RVH21
  • 11
  • 2

2 Answers2

1

I think you may have called your script itself pandas.py, or have a file named pandas.py in that directory? This will confuse the import

For numpy, first try:

pip install numpy

If that fails, reinstall both with:

pip uninstall pandas -y 
pip uninstall numpy -y 
pip install pandas numpy
Chris
  • 391
  • 1
  • 4
  • Yes, that was the problem. However, now the error says: raise ImportError( ImportError: Missing required dependencies ['numpy'] – RVH21 Mar 24 '21 at 17:23
  • You could try pip install numpy. Or reinstall everything: pip uninstall pandas -y pip uninstall numpy -y pip install pandas numpy – Chris Mar 24 '21 at 17:25
  • https://stackoverflow.com/questions/44220798/pandas-missing-required-dependencies-numpy – Wiliam Mar 24 '21 at 17:26
0

You have either not imported pandas, or imported pandas as pd. If you have imported pandas as pd, you should change your code to df = pd.read_excel(r'C:\Users\myname\Documents\email.xlsx')

torkestativ
  • 352
  • 2
  • 15
  • yeah, that was a typo, fixed my typo's and now the error says: raise ImportError( ImportError: Missing required dependencies ['numpy'] – RVH21 Mar 24 '21 at 17:24
  • you have to import numpy as well. If it is not installed you can try pip install numpy, or conda install numpy depending whether you use pip or anaconda as interpreter. – torkestativ Mar 24 '21 at 17:31