Error by running script with python3

I have tried to run a script with pandas in python3, but it appears to have an terrible error I even don't understand. Note: my script is "gh.py" and has an error in line 1, i can't import pandas.

File "gh.py", line 1 from pandas as pd ^ SyntaxError: invalid syntax

Upvotes: 2

Views: 41

Answers (2)

Norhther
Norhther

Reputation: 500

Maybe you’re using python2 instead of python3. Use the appropiate syntax to import pandas and also try

pip install pandas

Upvotes: 0

wim
wim

Reputation: 363314

The correct syntax would be:

import pandas as pd

Upvotes: 3

Related Questions