title: Groupby, count and calculate medians in Pandas
body: <p>I have this dataframe:</p>
  
  <pre><code>df:
        type . size .  margin .  height
  0 .      A .    2 .       5 .       1
  1 .      A .    3 .       4 .       1
  2 .      B .    1 .       1 .       3 
  </code></pre>
  
  <p>I want to groupby type, count the number of companies in each type and calculate the medians for all columns.</p>
  
  <p>I know that for count is like this</p>
  
  <pre><code>df=df.groupby('type').count('type')
  </code></pre>
  
  <p>But is there a way to use a one liner and put everything in the same df?</p>
  
  <p>Something like:</p>
  
  <pre><code>df=df.groupby('type').calculate_medians_and_counts
  </code></pre>
  
  <p>It should come out looking like this:</p>
  
  <pre><code>type    count   size   margin   height
     A        2    2.5      4.5        1
     B        1      1        1        3
  
  (size, margin and height are the medians from df)
  </code></pre>