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'
6
  • 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(.... Commented Mar 9, 2023 at 10:24
  • yes. I did but it throws the same error Commented Mar 9, 2023 at 10:28
  • not sure how your named your .py file, but check this in case: stackoverflow.com/questions/40554657/… Commented Mar 9, 2023 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? Commented Mar 9, 2023 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. Commented Mar 9, 2023 at 10:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.