Sometimes, we want to fix UnicodeDecodeError when reading CSV file in Pandas with Python.
In this article, we’ll look at how to fix UnicodeDecodeError when reading CSV file in Pandas with Python.
How to fix UnicodeDecodeError when reading CSV file in Pandas with Python?
To fix UnicodeDecodeError when reading CSV file in Pandas with Python, we can use the read_csv method to read the CSV.
For instance, we write
import pandas as pd
df = pd.read_csv('file_name.csv', engine='python')
to call read_csv with the CSV file path and the engine argument set to 'python' to read it with native Python csv module into a data frame.
Conclusion
To fix UnicodeDecodeError when reading CSV file in Pandas with Python, we can use the read_csv method to read the CSV.