Categories
Python Answers

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

Spread the love

To fix UnicodeDecodeError when reading CSV file in Pandas with Python, we call Pandas read_csv with the engine argument 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 and the engine set to 'python' to let Python decode the CSV content into the data frame df.

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 *