ModuleNotFoundError: no module named ‘pandas’

"ModuleNotFoundError: no module named ‘pandas’ ", but I am importing pandas, could you please check, here is link: https://replit.com/@ChocolateCroiss/boilerplate-demographic-data-analyzer#demographic_data_analyzer.py

Try opening the Shell tab and running:

poetry add pandas

If that fails, try:

pip install pandas
4 Likes

Strange (I tried FP’s answer on a fork). I ran the repl, got ModuleNotFoundError: No module named 'pandas'.

Ran poetry add pandas and got this:

The following packages are already present in the pyproject.toml and will be skipped:

  • pandas

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.

I still got the error, though.

pip seemed to do something, I didn’t get the initial error but got

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    demographic_data_analyzer.calculate_demographic_data()
  File "/home/runner/plip/demographic_data_analyzer.py", line 6, in calculate_demographic_data
    df = pd.DataFrame('adult.data.csv')
  File "/home/runner/plip/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 817, in __init__
    raise ValueError("DataFrame constructor not properly called!")
ValueError: DataFrame constructor not properly called!

which could be related to the program.

1 Like

Is there an update to this? I’m getting module not found error too.

poetry update package or pip install pandas or poetry add pandas doesn’t work?

If poetry add pandas says it’s already there, run poetry install.

1 Like

Worked now after logging out and logging in again, then deleting a couple of forks first (because I read in th forums that this solution worked – but it didn’t).
Now I’m encountering “TypeErrors index should be int or slice not str” in test_…py lines that have self.data [•••] Edited my outputs by forcing them into lists, but no luck. Can’t seem to edit the test_module.py which came with the fork. I don’t understand most of test_…py. Will post in a different thread, if I can’t make it work. Strange puzzle:)
Anyway, thanks for responding!!!
Sandy

Soo… logging out then in helped?

Yes, plus deleting the other duplicate forks, which I did based on some solutions in the forum. I did both consecutively so I don’t know which action solved it.

Mark that as the solution then.

3 Likes

Can’t, because they aren’t OP.

3 Likes

Qwertyqwerty88 said I can’t mark that as the soluion. Thanks anyway.

1 Like

This topic was automatically closed after 4 days. New replies are no longer allowed.