Bonjour à tous,
Je débute sur pandas mais ne parviens pas à importer un fichier .csv sur python via pandas.
Voici les 2 lignes de codes:
import pandas as pd
pd.read_csv('test.csv', sep = ',', nrows = 3,encoding = "utf-8")
Voici l’erreur que j’observe ensuite :
Traceback (most recent call last):
File "<pyshell#69>", line 1, in <module>
pd.read_csv('test.csv', sep = ',', nrows = 3,encoding = "utf-8")
File "C:\Users\manon.gautier\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\io\parsers.py", line 686, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Users\manon.gautier\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\io\parsers.py", line 452, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File "C:\Users\manon.gautier\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\io\parsers.py", line 936, in __init__
self._make_engine(self.engine)
File "C:\Users\manon.gautier\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\io\parsers.py", line 1168, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "C:\Users\manon.gautier\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\io\parsers.py", line 1998, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas\_libs\parsers.pyx", line 537, in pandas._libs.parsers.TextReader.__cinit__
File "pandas\_libs\parsers.pyx", line 711, in pandas._libs.parsers.TextReader._get_header
File "pandas\_libs\parsers.pyx", line 905, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas\_libs\parsers.pyx", line 2034, in pandas._libs.parsers.raise_parser_error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 135: invalid continuation byte
Désolée pour ce long post.
Merci beaucoup pour votre aide,
+0
-0