Turning Text into Numbers: to_numeric

Text such as '59 lbs' and '$75' becomes numbers in two steps, .str.replace to take off the units and symbols, then pd.to_numeric with errors='coerce' to convert what's left, followed by a list of the values that became missing so none is lost silently.

By

Updated

Cheat sheet: Turning Text into Numbers: to_numeric
Category
Data Analysis
Level
Apprentice
Tags
python, str.replace(), to_numeric(), Type Conversion (python)