ModuleNotFoundError: No module named 'pandas' in Python

Dung Do Tien Mar 19 2022 82

Hello guys, I am a newbie in Python and I have created a small app that uses panda to analyze data for me as below:

 import pandas as pd
import numpy as np

#create DataFrame
df = pd.DataFrame({'points': [22, 11, 13, 14, 17, 26, 29, 30],
                   'assists': [1, 9, 9, 6, 18, 8, 8, 6],
                   'rebounds': [12, np.nan, 12, 6, 4, np.nan, 8, 17]})

I copy code from my course in my class and run it. I got an error ModuleNotFoundError: No module named 'pandas'.

 Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

I am using Python version 3.9.11 and Windows 11.

How can I solve it?

Have 1 answer(s) found.
  • đ

    đặng thái sơn Mar 19 2022

    You can run the following command in your Linux/MacOS/Windows terminal:

     pip install pandas

    If you use Python 3, pls install by command:

     pip3 install pandas

    I hope it works for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close