gatzzidea
gatzzidea

Reputation: 1

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb4 in position 4: invalid start byte

I exported a csv file from Microsoft Excel. It showed properly in Jupyter notebook with pandas and numpy as below:

import pandas as pd
pd1 = pd.read_csv('test1.csv', encoding='utf-8')

There were no error messages the first time, but I just opened the csv file then just saved as a new name.

all the time I got a unicodeerror message

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb4 in position 4: invalid start byte

The data has strange letters as shown below. Even if there were strange letters, there was no problem at first.

2 columns, 6 rows

data

I have to handle all languages, so I really want to know how to encode them. How to solve this problem?

Upvotes: 0

Views: 1120

Answers (1)

Alex Liu 33214
Alex Liu 33214

Reputation: 72

When you save as, there will be a selection of the encoding format

How to select

Try to save as and see if it works.👍

Upvotes: 1

Related Questions