Menu Close

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

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.

Posted in Python, Python Answers