deuwde
deuwde

Reputation: 75

CSV Load Error with Pandas

Can someone help me figure out what this error is telling me? I don't understand why this csv won't load.

Code:

import pandas as pd
import numpy as np
energy = pd.read_csv('Energy Indicators.csv')
GDP = pd.read_csv('world_bank_new.csv')
ScimEn = pd.read_csv('scimagojr-3.csv')

Error:

    UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-2-65661166aab4> in <module>()
     10 
     11 
---> 12 answer_one()

<ipython-input-2-65661166aab4> in answer_one()
      4     energy = pd.read_csv('Energy Indicators.csv')
      5     GDP = pd.read_csv('world_bank_new.csv')
----> 6     ScimEn = pd.read_csv('scimagojr-3.csv')
      7 
      8 

Upvotes: 2

Views: 528

Answers (1)

Batman
Batman

Reputation: 8927

The read_csv function takes an encoding option. You're going to need to tell Pandas what the file encoding is. Try encoding = "ISO-8859-1".

Upvotes: 2

Related Questions