0

I would like to ask when I receive the following error upon trying to run a code : Pandas has no attribute read_csv where could be the problem if it exists in the official documentation ?

Traceback (most recent call last):
  File "C:\Users\YoanIvanov\Desktop\SamplePythonProgram\Day24\U.S States\us-states-game-end (original)\main.py", line 10, in <module>
    data = pandas.read_csv("50_states.csv")
AttributeError: module 'pandas' has no attribute 'read_csv'
Y.I
  • 25
  • 5
  • did you import pandas? usual way todo so is at top of your code, add: import pandas as pd. then your would do pd.read_csv(.... – Je Je Mar 09 '23 at 10:24
  • yes. I did but it throws the same error – Y.I Mar 09 '23 at 10:28
  • not sure how your named your .py file, but check this in case: https://stackoverflow.com/questions/40554657/module-pandas-has-no-attribute-read-csv – Je Je Mar 09 '23 at 10:31
  • 2
    I think you `import pandas as pd` so try with `pd.read_csv`. From the line 0 and the line 10, did you make something like `pandas = ...` Or do you create a file named `pandas.py`? – Corralien Mar 09 '23 at 10:46
  • @Corralien more likely to be the name of the file which conflict with a pandas lib. Maybe he called it pandas.py or somthing, as error code says no attribute rad_csv. check the link I posted above, likely is the reason, but will see. – Je Je Mar 09 '23 at 10:59
  • just try reinstalling the pandas module by running ```!pip install pandas``` in the command prompt or terminal – dramarama Mar 09 '23 at 11:05

0 Answers0