title: Pandas dataframe max and min value
body: <p>I have a pandas dataframe that looks like the following:</p>
  
  <pre><code>+-----+---+---+--+--+
  |     | A | B |  |  |
  +-----+---+---+--+--+
  | 288 | 1 | 4 |  |  |
  +-----+---+---+--+--+
  | 245 | 2 | 3 |  |  |
  +-----+---+---+--+--+
  | 543 | 3 | 6 |  |  |
  +-----+---+---+--+--+
  | 867 | 1 | 9 |  |  |
  +-----+---+---+--+--+
  | 345 | 2 | 7 |  |  |
  +-----+---+---+--+--+
  | 122 | 3 | 8 |  |  |
  +-----+---+---+--+--+
  | 233 | 1 | 1 |  |  |
  +-----+---+---+--+--+
  | 346 | 2 | 6 |  |  |
  +-----+---+---+--+--+
  | 765 | 3 | 3 |  |  |
  +-----+---+---+--+--+
  </code></pre>
  
  <p>What I want to do is get the max and min values from column 'B' given by the the range from 1 to 3 in column 'A'</p>
  
  <p>For example:</p>
  
  <pre><code>loop on A in range 1 to 3:
         get max and min values from column 'B'
         max = 6
         min = 3
  loop on the next range of A from 1 to 3:
         get max and min values from column 'B'
         max = 9
         min = 7           
  loop on the next range of A from 1 to 3:
         get max and min values from column 'B'
         max = 6
         min = 1
  </code></pre>
  
  <p>and add the min max values to a column like:</p>
  
  <pre><code>+-----+---+---+--+----+
  |     | A | B |min|max|
  +-----+---+---+--+----+
  | 288 | 1 | 4 | 3 | 6 |
  +-----+---+---+--+----+
  | 245 | 2 | 3 |   |   |
  +-----+---+---+--+----+
  | 543 | 3 | 6 |   |   |
  +-----+---+---+--+----+
  | 867 | 1 | 9 | 7 | 9 |
  +-----+---+---+--+----+
  | 345 | 2 | 7 |   |   |
  +-----+---+---+--+----+
  | 122 | 3 | 8 |   |   |
  +-----+---+---+--+----+
  | 233 | 1 | 1 | 1 | 6 |
  +-----+---+---+--+----+
  | 346 | 2 | 6 |   |   |
  +-----+---+---+--+----+
  | 765 | 3 | 3 |   |   |
  +-----+---+---+--+----+
  </code></pre>