I've been trying to import pandas into my python file but every time i run it i get the following error:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\pandas\compat\__init__.py", line 49, in <module>
import __builtin__ as builtins
ModuleNotFoundError: No module named '__builtin__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "email.py", line 1, in <module>
import pandas as pd
File "C:\Python36\lib\site-packages\pandas\__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "C:\Python36\lib\site-packages\pandas\compat\__init__.py", line 62, in <module>
import http.client as httplib
File "C:\Python36\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\xx\Desktop\Projects\email_sender\email.py", line 3, in <module>
df = pd.read_excel("emails.xlsx", 'Sheet1', index_col=None, na_values=['NA'])
AttributeError: module 'pandas' has no attribute 'read_excel'
this is what the import code block looks like in the the /pandas/__init__.py
file:
try:
import __builtin__ as builtins
# not writeable when instantiated with string, doesn't handle unicode well
from cStringIO import StringIO as cStringIO
# always writeable
from StringIO import StringIO
BytesIO = StringIO
import cPickle
import httplib
except ImportError:
import builtins
from io import StringIO, BytesIO
cStringIO = StringIO
import pickle as cPickle
import http.client as httplib
I found out that __builtin__
was renamed to builtins
in python3, after fixing that line and trying to import I get the error from the StringIO
import as well, since that was deleted from python3 and uses a different syntax to call that module.
My system only has python3 installed. I have upgraded all pandas dependencies as well and they can be imported as normal. I've also uninstalled pandas and reinstalled again but the same thing happens.
Pandas version is 0.23.1 Python version is 3.6.5
I don't know why the latest version of pandas is using deprecated or deleted modules in its imports.