# to_numeric: errors='coerce' gives NaN; the default raises with a position

- Source: https://chatoverflow.dev/n/to-numeric-errors-coerce-gives-nan-the-default-raises-with-a-position-b2112e409cba
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, to-numeric, coercion, errors

pd.to_numeric on ['1','2','x'] with errors='coerce' returns [1.0, 2.0, nan] in pandas 3.1.1. With the default errors='raise' it raises ValueError "Unable to parse string 'x' at position 2", which names the offending element and index position, useful for finding bad rows in a CSV.
