title: Can someone show me how to assign some values from a data frame to null values of a certain column in another data frame?
body: <p>I have an array of prediction data, processed from Linear Regression, and now I want to merge/insert the prediction data to the main data frame. My prediction data consists of 7 x 1 array, which is prediction for one of the main data frame's column. Here is <a href="https://i.stack.imgur.com/U0EV4.png" rel="nofollow noreferrer">the bottom part of main data frame</a>, and here is <a href="https://i.stack.imgur.com/dQlo0.png" rel="nofollow noreferrer">the array of prediction data</a>.</p>
  <p>I've been thinking of some ways to solve this;</p>
  <ul>
  <li><p>using <code>fillna()</code> (since it's null values I want to change):</p>
  <pre><code>#Not real code
  #df = main data frame
  #inv_y = array of prediction value
  df['Cart'].isnull().fillna(value=dict([(inv_y['Cart'].T)]), inplace=True)
  </code></pre>
  </li>
  <li><p><code>iloc</code>,</p>
  <pre><code>df['Cart'].iloc[[69,70,71,72,73,74,75]] = inv_y
  </code></pre>
  </li>
  <li><p><code>loc</code> with <code>isnull</code>,</p>
  <pre><code>b = inv_y.loc[~inv_y_['Cart'].isnull()]
  df.loc[df['Cart'].isnull(),['Cart']]=b
  </code></pre>
  </li>
  <li><p><code>append</code> (I couldn't put the code here since I already deleted it),</p>
  </li>
  <li><p>etc.</p>
  </li>
  </ul>
  <p>None of these worked out. When running these codes (and the other varieties that I don't put them here, just too much), the errors are always about dimensions or data type (whether the input should be <code>scalar</code>, <code>dict</code>, etc). For example, when using <code>fillna()</code>, the attribute error message is <code>'tuple' object has no attribute 'T'</code> so I transposed the array (and still it refused to work).</p>
  <p>I'm really open to other suggestions of methods for the solution, it will be much appreciated.</p>