TransWikia.com

Errors changing column dtype to numeric

Data Science Asked on June 10, 2021

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

One Answer

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.

Answered by Coconut on June 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP