Given the following data frame:
import pandas as pd
df = pd.DataFrame({'COL1': ['A', np.nan],
'COL2' : ['A','A']})
df
COL1 COL2
0 A A
1 NaN A
How might I replace the second cell in COL2 with "NaN" (that is, make it null) if the corresponding cell under COL1 is null ("NaN")?
Desired Result:
COL1 COL2
0 A A
1 NaN NaN
Note: I'm looking for a systematic solution that will work across n rows of COL1 and COL2.
Thanks in advance!