title: Numpy using smaller 2D array to map with bigger array with more elements
body: <p>I have a smaller array as:</p>
  
  <pre><code>A = np.array([2011, 2014, 2015, 2016, 2017])
  Aval = np.array([14, 10, 35, 40, 45])
  </code></pre>
  
  <p>I have another array:</p>
  
  <pre><code>A2 = np.array([2013, 2014, 2015, 2014, 2015, 2016, 2016, 2016, 2017])
  </code></pre>
  
  <p>I want to create A2val such that:</p>
  
  <pre><code>Arval = np.array([10, 35, 10, 35, 40, 40, 40, 45])
  </code></pre>
  
  <p>so, I am trying to use the values in array A to map to elements of A2 and generate an extended version of A2val</p>
  
  <p>Please note 2011 is present in A, 2013 is in A2 but not in A2 and A respectively. I can use the following suggested in another thread:</p>
  
  <pre><code>Aval[np.searchsorted(A,A2)]
  </code></pre>
  
  <p>But it doesn't produce the answer I am looking for.</p>