SyntaxFix
Write A Post
Hire A Developer
Questions
Quite old, yet I stumbled upon the very same issue. Try doing this:
df['col_replaced'] = df['col_with_npnans'].apply(lambda x: None if np.isnan(x) else x)