This thread here shows replace
with inplace=True
to change values in pandas data frame.
I want to apply the same technique, but replacing with None
mydf = pd.DataFrame({"col1":[5, 5, 8, 4, 5], "col2":[2, 5, 6, 7, 5]})
mydf.replace([5], None, inplace=True)
mydf
changes like this and there is an additional output
col1 col2
0 5 2
1 5 2
2 8 6
3 4 7
4 4 7
col1 None
col2 None
dtype: object
How to replace values with None
?