Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte

Tags:

python

I'm a newbie who are interested in Machine Learning using Python. So I downloaded a dataset from https://data.world/nrippner/ols-regression-challenge and tried to read the dataset using

dataset = pd.read_csv('cancer_reg.csv').

But that error message came up. What should I do?

like image 800
amiruladlil1911 Avatar asked May 22 '26 11:05

amiruladlil1911


2 Answers

Usually these type of issues arise because of the encoding. You can try using these two parameters in combination and it should probably work. I'm using latin1 because of the 0x1f you provide in your error.

dataset = pd.read_csv('cancer_reg.csv',engine='python',encoding='latin1')
like image 73
Celius Stingher Avatar answered May 25 '26 01:05

Celius Stingher


Try the following

dataset = pd.read_csv('cancer_reg.csv',encoding = "ISO-8859-1")
like image 39
Arjun Bhasin Avatar answered May 25 '26 01:05

Arjun Bhasin