title: Pythonic Way to Find Next Biggest Number in an Array?
body: <p>Let's say I have a dataframe with a column of closing prices, and a separate (not included in the dataframe) list of max's like so:</p>
  
  <pre><code>Closes      Max's
  1           3
  2           5
  3           7
  4           6
  5           2
  4
  3
  2
  1
  </code></pre>
  
  <p>What is a pythonic way to add another column to the dataframe, where it grabs the next biggest number, comparing each close to the numbers in the list? Such that, the expected output would be:</p>
  
  <pre><code>Closes      Next_Biggest
  1           2
  2           3
  3           5
  4           5
  5           6
  4           5
  3           5
  2           3
  1           2
  </code></pre>
  
  <p>Something pseudo like:</p>
  
  <pre><code>df['Next_Biggest'] = i where df['Closes'] &gt; i and &lt; i for i in Max's 
  </code></pre>
  
  <p>...or maybe to sort the Max's list from smallest to largest and then somehow loop through each Closes and compare one at a time to see if it's less than the current Max it's trying to compare to? Help! Thanks!</p>