I have a small dataframe (df):
unique a b c d
0 None None None None
1 None None None None
2 None 0132 None None
3 None None None 0231
4 None None None None
5 None None 0143 None
6 0121 None None None
7 None None None 0432
I need to replace all values with NaN. I tried to apply df.fillna(np.NAN), but it does not change the value in cells, where there is a number.
How do I make all the values have been replaced?
Dataframe should look like this:
unique a b c d
0 NaN NaN NaN NaN
1 NaN NaN NaN NaN
2 NaN NaN NaN NaN
3 NaN NaN NaN NaN
4 NaN NaN NaN NaN
5 NaN NaN NaN NaN
6 NaN NaN NaN NaN
7 NaN NaN NaN NaN
df.fillna()kind of does the opposite of what you want. It replaces allNaN-values with another value. Sodf.fillna(np.NAN)replaces allNaNwithNaNwhich makes no sense.