title: Individually replace NaN in pandas.dataframe
body: <p>I have a 900 x 7 dataframe in which 3 fields contain some NaN values.</p>
  
  <p>Instead of simply replacing these values with the some feature average, I have created a function to use an algorithm to estimate the likely value of each NaN based on the other values in that row.</p>
  
  <p>How can I iterate over each NaN to change it's value using my custom function?</p>
  
  <p>My function takes the row ID, the other feature names, and the feature containing the NaN as arguments.</p>
  
  <p>E.g.</p>
  
  <pre><code>custom_fillnan(id=0, ins=["val0", "val1", "val2"], out="valn")
  </code></pre>
  
  <p>Example dataframe:</p>
  
  <pre><code>ID    val0    val1    val2    ...    valn
  0      1        2       3     ...    NaN
  1      1      NaN       3     ...     4
  2      0        0     NaN     ...     1
  ...
  </code></pre>