title: pandas: fill nans given a condition
body: <p>I'm struggling with something that seemed to be trivial but apparently isn't. General picture: <code>data</code> - pandas dataframe - contains(among others) <code>TOTAL_VISITS</code> and <code>NUM_PRINTS</code> columns.</p>
  
  <p>Objective: given <code>num_prints</code> parameter, find rows where <code>NUM_prints = num_prints</code> and fill <code>nan</code>s with a given number.</p>
  
  <p>Where I stopped and it didn't make sense anymore:</p>
  
  <pre><code>indices= data['NUM_PRINTS'] == num_prints
  
  data.loc[indices,'TOTAL_VISITS'].fillna(5,inplace=True)
  </code></pre>
  
  <p>This should work as much as I know and read. didn't fill nans with anything in practice, seemed like it worked with a copy or something as it didn't change anything in the original object.</p>
  
  <p>What works:</p>
  
  <pre><code>data.loc[indices,'TOTAL_VISITS'] = 2
  </code></pre>
  
  <p>this does fill the column with 2's on the <code>num_print</code> condition, but does not consider nans.</p>
  
  <pre><code>data['TOTAL_VISITS'].fillna(0, inplace=True)
  </code></pre>
  
  <p>this does fill the nans in total visits with 0, but does not consider the <code>num_prints</code> condition.</p>
  
  <p>I'm kinda hopeless as a regular <code>for</code> loop with <code>.iloc</code> and conditions takes way too long than I can handle.</p>