title: Pandas comparing dataframe with student results against historic quantiles
body: <p>I have two dataframes. One shows student test results  by class on two tests</p>
  
  <pre><code>import pandas as pd   
   results = pd.DataFrame({
      'id':[1,2,3],
      'class':[1,1,2],
      'test_1':[0.67,0.88,0.33],
      'test_2':[0.76,0.63,0.78]})
      results
  </code></pre>
  
  <blockquote>
  <pre><code>   id  class  test_1  test_2
  0   1      1    0.67    0.76
  1   2      1    0.88    0.63
  2   3      2    0.33    0.78
  </code></pre>
  </blockquote>
  
  <p>The other shows quantiles by class and test based on previous semesters</p>
  
  <pre><code>quantiles = pd.DataFrame({'class':[1,2],
  'test_1_0.25':[0.23,0.31],
  'test_1_0.5':[0.54,0.67],
  'test_1_0.75':[0.8,0.9],
  'test_2_0.25':[0.23,0.31],
  'test_2_0.5':[0.54,0.67],
  'test_2_0.75':[0.8,0.9]})
  </code></pre>
  
  <blockquote>
  <pre><code>  class  test_1_0.25  test_1_0.5  test_1_0.75  test_2_0.25  test_2_0.5  \
  0      1         0.23        0.54          0.8         0.23        0.54   
  1      2         0.31        0.67          0.9         0.31        0.67
  
     test_2_0.75  
  0          0.8  
  1          0.9
  </code></pre>
  </blockquote>
  
  <p>I would like to return a datarfame that tells me what quantile they place in. 0 if they are below 25, 1 if below 50, 2 if below 75, and 3 if above 75. So the output would look like this</p>
  
  <blockquote>
  <pre><code>   id  test_1_quantile  test_2_quantile  
  0   1                2                2   
  1   2                3                1   
  2   3                1                2  
  </code></pre>
  </blockquote>
  
  <p>Any help is much appreciated. Thanks</p>