1In [27]: df
2Out[27]:
3 A B C
40 -0.120211 -0.540679 -0.680481
51 NaN -2.027325 1.533582
62 NaN NaN 0.461821
73 -0.788073 NaN NaN
84 -0.916080 -0.612343 NaN
95 -0.887858 1.033826 NaN
106 1.948430 1.025011 -2.982224
117 0.019698 -0.795876 -0.046431
12
13#The "subset" argument is used to select columns for which you want the NaN values to be dropped
14#Set "inplace=True" if you want the new table to overwrite the old table.
15In [28]: df.dropna(subset=['A', 'B'], inplace=True)
16Out[28]:
17 A B C
180 -0.120211 -0.540679 -0.680481
191 -0.916080 -0.612343 NaN
202 -0.887858 1.033826 NaN
213 1.948430 1.025011 -2.982224
224 0.019698 -0.795876 -0.046431