title: Adding a row from a dataframe into another by matching columns with NaN values in row pandas python
body: <h2>The Scenario:</h2>
  
  <p>I have 2 dataframes <code>fc0</code> and <code>yc0</code>. Where <code>fc0</code> is a Cluster and <code>yc0</code> is another dataframe which needs to be merged in <code>fc0</code>.</p>
  
  <p>The Nature of data is as follows:</p>
  
  <p><strong>fc0</strong></p>
  
  <pre><code>uid         1         2         3         4         5         6  
  234  235  4.000000  4.074464  4.128026  3.973045  3.921663  4.024864   
  235  236  3.524208  3.125669  3.652112  3.626923  3.524318  3.650589   
  236  237  4.174080  4.226267  4.200133  4.150983  4.124157  4.200052
  </code></pre>
  
  <p><strong>yc0</strong></p>
  
  <pre><code>iid  uid    1    2    5    6    9    15
  0    944  5.0  3.0  4.0  3.0  3.0  5.0 
  </code></pre>
  
  <h2>The Twist</h2>
  
  <p>I have 1682 columns in <strong>fc0</strong> and I have few hundered values in <strong>yc0</strong>. Now I need the <strong>yc0</strong> to go into <strong>fc0</strong></p>
  
  <p>In haste of resolving it, I even tried <code>yc0.reset_index(inplace=True)</code> but wasn't really helpful.</p>
  
  <h2>Expected Output</h2>
  
  <pre><code>     uid         1         2         3         4         5         6  
  234  235  4.000000  4.074464  4.128026  3.973045  3.921663  4.024864   
  235  236  3.524208  3.125669  3.652112  3.626923  3.524318  3.650589   
  236  237  4.174080  4.226267  4.200133  4.150983  4.124157  4.200052
  944  5.0       3.0       NaN       NaN       4.0       3.0       3.0
  </code></pre>
  
  <h2>References</h2>
  
  <p><a href="https://stackoverflow.com/questions/10715965/add-one-row-in-a-pandas-dataframe">Link1</a> Tried this, but landed up inserting NaN values for 1st 16 Columns and rest of the data shifted by that many columns</p>
  
  <p><a href="https://stackoverflow.com/questions/12555323/adding-new-column-to-existing-dataframe-in-python-pandas">Link2</a> Couldn't match column keys, besides I tried it for row.</p>
  
  <p><a href="https://stackoverflow.com/questions/32333157/combining-2-dataframes">Link3</a> Merging doesn't match the columns in it.</p>
  
  <p><a href="https://stackoverflow.com/questions/10972410/pandas-combine-two-columns-in-a-dataframe#10972557">Link4</a> Concatenation doesn't work that way.</p>
  
  <p><a href="https://stackoverflow.com/questions/28773683/combine-two-pandas-dataframes-with-the-same-index">Link5</a> Same issues with Join.</p>
  
  <h2>EDIT 1</h2>
  
  <pre><code>fc0.info()
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  Int64Index: 235 entries, 234 to 468
  Columns: 1683 entries, uid to 1682
  dtypes: float64(1682), int64(1)
  memory usage: 3.0 MB
  </code></pre>
  
  <p>and</p>
  
  <pre><code>yc0.info()
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  RangeIndex: 1 entries, 0 to 0
  Columns: 336 entries, uid to 1007
  dtypes: float64(335), int64(1)
  memory usage: 2.7 KB
  </code></pre>