0
$\begingroup$

I am working with data from the government regarding COVID immunization numbers and would like to convert object columns into numeric. I am using Python in Jupyter Notebook. I tried using to_numeric, but the dtype is still an object. Any suggestions?

Thanks in advance :)

enter image description here

$\endgroup$
0
$\begingroup$

Set the errors parameter of the to_numeric function to 'coerce'. The value 'ignore' will leave any invalid value as is while 'coerce' will set it to NaN.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.