Wednesday, 30 October 2019

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

While reading the excel file you receive the below error

train = pd.read_csv("Train.csv")
train.head()


"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte"


Include the encoding parameter in read_csv function as below

train = pd.read_csv("Train.csv",encoding='latin-1')


train.head()

now you will be able to read the file




No comments:

Post a Comment