fill NaN with another lookup table
<p>Is there a way to fill the <code>NaN</code> with value for <code>test=default</code> by matching name, reticle and cell rev?</p>

<p><a href="http://i.stack.imgur.com/8gZ38.png" rel="nofollow"><img src="http://i.stack.imgur.com/8gZ38.png" alt="enter image description here"></a></p>

<p><a href="http://i.stack.imgur.com/A71KG.png" rel="nofollow"><img src="http://i.stack.imgur.com/A71KG.png" alt="enter image description here"></a></p>

<p>with the few variables in "test" column:
<a href="http://i.stack.imgur.com/MYDOO.png" rel="nofollow"><img src="http://i.stack.imgur.com/MYDOO.png" alt="enter image description here"></a></p>

<p>Is there a way to update the values from others row ? as the datatype "do" would have higher precedence than int and drop the "do" data row?</p>

<p>data:<br>
test  datatype name value   reticle cell_rev<br>
default int s   0x45        CR1<br>
default int s   0xCB        CR3<br>
default do  s   0.68        CR1 </p>

<p>I'd like to get:  </p>

<p>test  datatype name value   reticle cell_rev<br>
default int s   0.68        CR1<br>
default int s   0xCB        CR3  </p>

<pre><code>for i in range(len(df)):
    if df.loc[i, 'value_new'] != df.loc[i, 'value_new']:
        df.loc[i, 'value_new'] = df.loc[(df.test == 'default') &amp;
                                        (df.name == df.loc[i, 'name']) &amp;
                                        (df.reticle == df.loc[i, 'reticle']) &amp;
                                        (df.cell_rev == df.loc[i, 'cell_rev']),
                                        'value_new']
</code></pre>

<p>I think there's a more efficient solution, but this should work.</p>

python pandas dataframe multiple-columns