简体   繁体   中英

Python Pandas in colab:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byteUnicodeDecodeError:

guys i have been trying to load some datasets from kaggle which has been downloaded already.

hist_trans = pd.read_csv('historical_transactions.csv')

new_trans = pd.read_csv('new_merchant_transactions.csv')


train = pd.read_csv('train.csv', parse_dates=['first_active_month'])

test = pd.read_csv('test.csv', parse_dates=['first_active_month'])

And i had this error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

Try encoding option in read_csv like below.

read_csv('file', encoding = "utf-8")

or

read_csv('file', encoding = "ISO-8859-1")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM