SORRY FOR MY ENGLISH. I'M LEARNING.
In my case, I solved the error by changing the file name.
# in file: csv.py
import pandas as pd
data = {'first_name': ['Sigrid', 'Joe', 'Theodoric','Kennedy', 'Beatrix', 'Olimpia', 'Grange', 'Sallee'],
'last_name': ['Mannock', 'Hinners', 'Rivers', 'Donnell', 'Parlett', 'Guenther', 'Douce', 'Johnstone'],
'age': [27, 31, 36, 53, 48, 36, 40, 34],
'amount_1': [7.17, 1.90, 1.11, 1.41, 6.69, 4.62, 1.01, 4.88],
'amount_2': [8.06, "?", 5.90, "?", "?", 7.48, 4.37, "?"]}
datosDataFrame = pd.DataFrame(data)
print(datosDataFrame)
datosDataFrame.to_csv('example.csv')
I get an error
Error: AttributeError partially initialized module 'pandas' has no
attribute 'DataFrame' (most likely due to a circular import)
"Most likely due to a circular import" means any variable/name is repeated. In my case, my script csv.py
conflicted with csv
in the standard library.
Visitors
array. It then worked fine for me. – Prognosis