AttributeError: module 'pandas' has no attribute 'read_csv' Python3.5

pandas, python, python-3.x

Solution

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.

Problem

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') ``` The error is ``` AttributeError: module 'pandas' has no attribute 'read_csv' ``` I have tried to upgrade pandas but does not work. I tried to search and got this answer but when I search csv.py file in my pandas I didn't find any. So i tried to hover over the `pandas.read_csv` method which takes me to `parsers.py` file. But in that file there is no specific method named `read_csv` but it directed to another parser funtion like this ``` # parser.py (built-in file in pandas) file has this implementation read_csv = _make_parser_function('read_csv', sep=',') read_csv = Appender(_read_csv_doc)(read_csv) ``` I don't understand how should it start working again ? Any suggestions

Original source

Related problems