Question: I want to fill missing values of a specific column only if a condition is met.

```
e.g. A    B
     Nan  0
     Nan  0
     0    0
     Nan  1
     Nan  1
     .....................
     .....................

```

In the above case I want to fill Nan values in column A only when corresponding value in column B is 0. Rest values in A (with Nan) should not change.

Answer: 
np.where is quicke and simple solution.

```
In [47]: df['A'] = np.where(np.isnan(df['A']) & df['B'] == 0, 3, df['A'])
In [48]: df
Out[48]: 
     A  B
0  3.0  0
1  3.0  0
2  3.0  0
3  NaN  1
4  NaN  1

```
You should use a loop over all elements, something like this:

```
for i in range(len(A))
   if numpy.isnan(A[i]) && B[i] == 0:
      A[i] = value

```

There are nicer ways to implement these loops, but I don't know what structures you are using.