Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: partially initialized module 'pandas' has no attribute 'DataFrame'

i want to run this code but i can't and received this error. also i downloaded pandas package.

import pandas

data = {
    "Day": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    "Visitors": [18, 26, 18, 18, 9, 9, 20, 30, 16, 24],
    "Bounce_Rate": [77.27, 74.07, 73.68, 65, 90, 70, 72, 62.16, 81.25, 72],
}

df = pandas.DataFrame(data)
print(df)
like image 765
bnh Avatar asked Dec 18 '22 13:12

bnh


1 Answers

Have you have saved your file as pandas.py? It will confuse the namespace if the file is named pandas.py Otherwise check if there is any file named pandas and delete it. So that you can definitely succeed in fixing this.

like image 64
Sirisha Vemavarapu Avatar answered May 04 '23 20:05

Sirisha Vemavarapu