Categories
Python Answers

How to fix UnicodeDecodeError when reading CSV file in Pandas with Python?

Spread the love

To fix UnicodeDecodeError when reading CSV file in Pandas with Python, we call read_csv with engine set to 'python'.

For instance, we write

import pandas as pd
df = pd.read_csv('file_name.csv', engine='python')

to call read_csv with the file path of the CSV and engine set to 'python' to use the Python native CSV parser to parse the CSV.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *