close

[Solved] UnicodeDecodeError, invalid continuation byte

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error UnicodeDecodeError, invalid continuation byte in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How UnicodeDecodeError, invalid continuation byte Error Occurs?

Today I get the following error UnicodeDecodeError, invalid continuation byte in python.

How To Solve UnicodeDecodeError, invalid continuation byte Error ?

  1. How To Solve UnicodeDecodeError, invalid continuation byte Error ?

    To Solve UnicodeDecodeError, invalid continuation byte Error Use this, If it shows the error of UTF-8
    pd.read_csv('File_name.csv',encoding='latin-1')

  2. UnicodeDecodeError, invalid continuation byte

    To Solve UnicodeDecodeError, invalid continuation byte Error Use this, If it shows the error of UTF-8
    pd.read_csv('File_name.csv',encoding='latin-1')

Solution 1

I had the same error when I tried to open a CSV file by pandas.read_csv method.

The solution was change the encoding to latin-1:

pd.read_csv('ml-100k/u.item', sep='|', names=m_cols , encoding='latin-1')

Solution 2

Use this, If it shows the error of UTF-8

pd.read_csv('File_name.csv',encoding='latin-1')

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read