Skip to content
Advertisement

TypeError: object cannot be converted to an IntegerDtype

I want to replace nan values in B with A in df:

df:

JavaScript

df data types:

JavaScript

I tried:

JavaScript

and it caught error:

JavaScript

Advertisement

Answer

Use numpy.where for avoid floats in output column:

JavaScript

JavaScript

If need strings in output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement