title: pandas DataFrame update/combine when indices don't align
body: <p>Consider two dataframes which store information on the same characteristic of the same observation, but for different time periods:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  df1 = pd.DataFrame({"obs":["a","a","b","b"],
      "year":[1,2,1,2],
      "val":[3, np.NaN, 3, np.NaN]})
  
  df1
  
  Out:
     obs  val  year
  0    a    3     1
  1    a  NaN     2
  2    b    3     1
  3    b  NaN     2
  
  df2 = pd.DataFrame({"obs":["a","a","b","b"],
      "val":[np.NaN, 4, np.NaN, 4],
      "year":[1,2,1,2]})
  df2.index = (range(5,9))
  
  df2
  
  Out:
     obs  val  year
  5    a  NaN     1
  6    a    4     2
  7    b  NaN     1
  8    b    4     2
  </code></pre>
  
  <p>Now I would like to merge or combine these two data frames such that the values are collected in a single column, with the <code>NaN</code> in <code>df1</code> replaced by the corresponding observation-year values from <code>df2</code>.
  I can achieve this by doing:</p>
  
  <pre><code>merged = pd.merge(df1, df2, on=["obs", "year"], how="left")
  merged.loc[~np.isfinite(merged.val_x), 'val_x'] = merged[~np.isfinite(merged.val_x)].val_y
  </code></pre>
  
  <p>i.e. essentially doing a regular merge and then replacing the <code>NaN</code>s in one column with the values for the other column by hand. </p>
  
  <p>Is there a better/more succinct way of doing this? I feel like some sort of <code>df.combine</code>, <code>df.combine_first</code>, <code>df.update</code> would do what I'm after, but they all seem to align on indices. </p>