title: Find min, max and average of an ID in Python Pandas
body: <p>I have two Dataframes in Python Pandas. Let's say that the first one is the <code>df1</code>. It is not necessary that the id column is ordered. </p>
  
  <pre><code>   id  B  C
  0   1  5  1
  1   1  5  1
  2   1  6  1
  3   1  7  1
  4   2  5  1
  5   2  6  1
  6   2  6  1
  7   3  7  1
  8   3  7  1
  9   4  6  1
  10  4  7  1
  11  4  7  1
  </code></pre>
  
  <p>Then the second dataframe <code>df2</code> has a column with the unique values of the <code>id</code></p>
  
  <pre><code>   id
  0   1
  1   2
  2   3
  3   4
  </code></pre>
  
  <p>I want to calculate the min, max and average of column <code>B</code> for each <code>id</code> and add it to the second dataframe. The result would be like this:</p>
  
  <pre><code>   id  min  max  avg
  0   1   5    7   5.75
  1   2  ..
  2   3  ..
  3   4  ..
  </code></pre>
  
  <p>In this example, I was able to replicate it by calculating them for each <code>id</code> manual. It was not a problem since the example has only 4 ids. But my real example has more than 1000 ids. Is there any automatic way to do it?</p>