Menu Close

How to fix Python Pandas Error tokenizing data?

To fix Python Pandas Error tokenizing data, we call read_csv with the on_bad_lines argument set to 'skip'.

For instance, we write

data = pd.read_csv('file1.csv', on_bad_lines='skip')

to call read_csv with the file path and the on_bad_lines argument set to 'skip' to skip the bad lines when reading the CSV.

Posted in Python, Python Answers