How to change entire row if NaN present if a single column has NaN
What I will do reindex
df.dropna().reindex(df.index)
mask
:
df.mask(df.gauge.isna())
gauge satellite
1979-06-23 18:00:00 6.700000 2.484378
1979-06-27 03:00:00 NaN NaN
1979-06-27 06:00:00 1.833333 4.053460
1979-06-27 09:00:00 NaN NaN
1979-07-31 18:00:00 6.066667 1.438324
use np.where
to add nan
import numpy as np
df['satellite'] = np.where(df['gauge'].isnull(),np.nan,df['satellite'])
Second solution
use .loc
and isnull
df.loc[df['guage'].isnull(),'satellite'] = np.nan