import pandas as pd
df = pd.read_csv('FBI-CRIME11.csv')
print(df.head())
L'exécution de ce code simple me donne l'erreur:
Traceback (most recent call last):
File "C:/Users/Dita/Desktop/python/lessons/python.data/csv.py", line 1, in <module>
import pandas as pd
File "C:\python\lib\site-packages\pandas-0.19.1-py3.5-win-AMD64.Egg\pandas\__init__.py", line 37, in <module>
import pandas.core.config_init
File "C:\python\lib\site-packages\pandas-0.19.1-py3.5-win-AMD64.Egg\pandas\core\config_init.py", line 18, in <module>
from pandas.formats.format import detect_console_encoding
File "C:\python\lib\site-packages\pandas-0.19.1-py3.5-win-AMD64.Egg\pandas\formats\format.py", line 33, in <module>
from pandas.io.common import _get_handle, UnicodeWriter, _expand_user
File "C:\python\lib\site-packages\pandas-0.19.1-py3.5-win-AMD64.Egg\pandas\io\common.py", line 5, in <module>
import csv
File "C:\Users\Dita\Desktop\python\lessons\python.data\csv.py", line 4, in <module>
df = pd.read_csv('FBI-CRIME11.csv')
AttributeError: module 'pandas' has no attribute 'read_csv'
Essayez de renommer votre csv.py
à autre chose, comme csv_test.py
. Il semble que pandas
ne sache pas quoi importer.