Skip to content
Advertisement

Replacing NONE with Nan – but it Reappears in Subsequent Output of Code

I am trying to replace None (not recognized as a string) with nan — and fill those nans with the mode of the field, but when I further condense the field — None appears back in the output. What am I missing?

JavaScript

None is back… What am I missing/doing wrong here? If I rerun that last section, None will disappear – but its worrisome to see it appear in the output, then disappear upon a second run.

Advertisement

Answer

Inside your reduce_housing_status function you forgot to add a return statement when x in Homeless:

JavaScript

Which means you’re implicitly returning None

Advertisement