Nathalia Dias
Nathalia Dias

Reputation: 3

'utf-8' codec can't decode using pandas and reading xlsx

I'm trying read a xlsx file in python with padas but i get this:

'utf-8' codec can't decode byte 0xc9 in position 6: invalid continuation byte

import pandas as pd
data = pd.read_excel(r'C:\Users\nlsouza\Desktop\teste3.xlsx')
query = data['Final'].values.tolist()

Upvotes: 0

Views: 2588

Answers (1)

LucasFab
LucasFab

Reputation: 95

You are probably trying to read an excel file containing special characters (Russian Symbols ... ).

You should add a parameter to your read_excel :

df=pd.read_excel(r'C:\Users\nlsouza\Desktop\teste3.xlsx',encoding='utf-8')

Hope it'll work for you

Upvotes: 1

Related Questions