FileExamples
ErrorCSV · .csv

CSV Inconsistent Columns — Row Length Mismatch

A CSV file where different rows have different numbers of columns, causing import failures and data misalignment.

Why It Fails

Most CSV parsers expect all rows to have the same number of columns as the header row. Extra or missing columns cause data to shift into wrong fields or trigger parse errors.

Broken Example

name,age,city
Alice,30,New York
Bob,34
Charlie,45,Tokyo,Japan,Extra

Expected Error Behavior

pandas raises ParserError: Error tokenizing data. PostgreSQL COPY fails with extra data after last expected column.

Affected Software

pandasPostgreSQL COPYMySQL LOAD DATAExcel Power QueryApache Spark

How to Fix

Validate column counts before import. Use error_bad_lines=False in pandas. Pad short rows or truncate long rows.