Skip to content Skip to sidebar Skip to footer

Attributeerror: Module 'pandas' Has No Attribute 'read_csv' Python3.5

I have been successfully using pandas.read_csv since long but suddenly it starts giving the error while I try to read a csv file df = pd.read_csv('file.csv', encoding='utf-8') Th

Solution 1:

I had the same problem when trying to run the following code in Jupyter/ipython.

import pandas as pd
df = pd.read_csv("weather_data.csv")
df

I realized I had a file named pandas.py. In fact, had two others named pandas1.py and pandas2.py as well. I changed them all and then it worked perfectly:) Lesson learned.

Solution 2:

So I am writing an answer myself. I just noticed that I created a file random.py in my project which was creating a conflict with random.py in pandas package. Renaming my current file to something else worked for me :)

Solution 3:

I faced the same problem and the solution that worked for me is as below.

Initially I installed the pandas and numpy with a regular user account. It installed library but there were few conflicts. So I uninstalled the libraries using pip uninstall package then installed them back as sudo account using sudo -H pip install package.

I hope it helps other people facing similar issue.

Solution 4:

You literally just need to make sure that you have no ".py" files that have names of the same names of the packages. Like pandas.py, numpy.py etc..

Solution 5:

Try print(pd)

Make sure you are getting this kind of output

<module'pandas'from'C:\\Users\\adarsh\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\pandas\\__init__.py'>

Otherwise, there may be another python file named pandas in your current working directory

For more click here

Post a Comment for "Attributeerror: Module 'pandas' Has No Attribute 'read_csv' Python3.5"