import pandas as pd
import numpy as np
df = pd.DataFrame([[1,2,3],[4,5,6]], columns=['a','b','c'])
df[df['c'] == 3]['a'] = np.nan
df
>>>
a b c
0 1 2 3
1 4 5 6
Why is 0,a
not NaN? I would expect that the value in 0,a
would have been replaced by np.nan
.