Whenever a nightly CSV import starts failing on dirty strings, somebody eventually opens a pull request with this one-liner:
python
df [ " amount " ] = pd . to_numeric ( df [ " amount_raw " ], errors = " coerce " ). fillna ( 0.0 )
Enter fullscreen mode
Exit fullscreen mode
I get why people write it. When you have 500,000 payment events waiting to load and row 41,209 contains "$1,299.00" instead of "1299.00", letting float() blow up the whole job at 3:00 AM feels worse than coercing bad strings to NaN.
Except errors="coerce" doesn't just skip broken rows. Paired with .fillna(0.0), it turns formatted enterprise invoices into zero-dollar charges without logging a single warning.…