title: Default value for pandas lookup when lookup value doesn't exist or is null
body: <p>I have a dataframe that looks like this:</p>
  
  <pre><code>       parent region
  estid               
  1         NaN      A
  2         NaN      B
  3         1.0      A
  4         1.0      B
  5         2.0      C
  6         2.0      C
  7         8.0      A
  </code></pre>
  
  <p>What I want is to create an extra column containing the <code>region</code> of the <code>parent</code>, defaulting to <code>None</code> if the parent is not found in the data, e.g.:</p>
  
  <pre><code>       parent region parent_region
  estid                             
  1         NaN      A          None
  2         NaN      B          None
  3         1.0      A             A
  4         1.0      B             A
  5         2.0      C             B
  6         2.0      C             B
  7         8.0      A          None
  </code></pre>
  
  <p>The following returns the correct result:</p>
  
  <pre><code>df["parent_region"] = df.apply(lambda x : df.loc[x["parent"]]["region"] if not math.isnan(x["parent"]) and x["parent"] in df.index else None, axis = 1)
  </code></pre>
  
  <p>But I'm very scared of inefficiencies, given that my dataframe has 168 million rows. Is there a better way to do it? I looked at <code>lookup</code> and <code>get</code> but I can't quite figure out how to work with IDs that can be <code>NaN</code> or not present in the dataframe.</p>
  
  <p>For instance, I thought this could work: <code>df.lookup(df["region"], df["parent"])</code>, but it doesn't like very much null keys. <code>df.get("region")</code> does not return the parent's region, but the column itself, so it doesn't do what I want.</p>