Python 2.7 encoding from csv file
<p>I have a problem with Python 2.7 encoding I have a csv file with some french characters (mangÃ©, parlÃ©, prÃªtre ...), the code I'm using is the following:</p>

<pre><code>import pandas as pd
path_dataset = 'P:\\Version_python\\Dataset\\data_set - Copy.csv'
dataset = pd.read_csv(path_dataset, sep=';')

for lab, row in dataset.iterrows():
    print(row['Summary'])
</code></pre>

<p>I tried to add <code>encoding</code> to <code>read_csv()</code>, it didn't work. I tried <code>unicode</code>, <code>decode</code>(UTF-8) ... Nothing worked.</p>

<p>Then I tried to concatenate those extracted words with some text, and I got a utf-8 error, I don't know how to deal with that. Thanks</p>

<p>Here is a list of standard python encodings</p>

<p><a href="https://docs.python.org/2/library/codecs.html" rel="nofollow">Standard Python 2.7 encodings</a></p>

<p><code>utf-8</code> does not work but you can try some other encodings on the link above.</p>

<p>Just tested <code>latin_1</code> works. So the code should be:</p>

<pre><code>dataset = pd.read_csv(path_dataset, sep=';', encoding='latin_1')
</code></pre>

python python-2.7 pandas