Shadowtrooper
Shadowtrooper

Reputation: 1454

Can't import Dataframe in pandas

I'm trying to run this code:

import pandas as pd

df = pd.Dataframe(["asdfasdf"])

Also I have tried with:

df = pd.Dataframe(data=["asdfasdf"])

I have tried with python version 3.8.10 and 3.9.5. Also with pandas 0.25 and 1.2. I always get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/aitor/.local/lib/python3.8/site-packages/pandas/__init__.py", line 244, in __getattr__
    raise AttributeError(f"module 'pandas' has no attribute '{name}'")
AttributeError: module 'pandas' has no attribute 'Dataframe'

How can I fix this?

Upvotes: 1

Views: 70

Answers (1)

Andreas
Andreas

Reputation: 9197

Use pd.DataFrame() If you are unsure about something like that normally your IDE should do suggestions for auto-completion.

Like if you enter: pd.Da ...

enter image description here

Also you can always check the documentation.

Upvotes: 2

Related Questions