title: groupby and calculate mean but keeping all columns
body: <p>I would like to calculate the mean of the numeric columns using groupby but maintaining all columns. An example of a dataframe from 7 columns is here:</p>
  
  <pre>
  tracking_id gene_id gene_short_name tss_id  locus   FPKM-1  FPKM-2
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   Tss1231 1:4490927-4496413   0.611985    232
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   Ts412   1:4490927-4496413   12  21
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   Ts56    1:4490927-4496413   2   213
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   TS512   1:4490927-4496413   0.611985    5
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   TS12241 1:4490927-4496413   0.611985    51
  ENSMUSG00000096126  ENSMUSG00000096126  Gm22307 TS124   1:4529016-4529123   35  1
  ENSMUSG00000096126  ENSMUSG00000096126  Gm22307 TS-1824 1:4529016-4529123   1   2
  ENSMUSG00000096126  ENSMUSG00000096126  Gm22307 TS1249082   1:4529016-4529123   2   5
  ENSMUSG00000088000  ENSMUSG00000088000  Gm25493 TS1290328   1:4723276-4723379   0   1
  ENSMUSG00000098104  ENSMUSG00000098104  Gm6085  TS01239-1   1:4687933-4689403   0.0743559   6
  ENSMUSG00000033845  ENSMUSG00000033845  Mrpl15  TSS31014,TSS82987,TSS82990,TSS86849 1:4773205-4785739   79.1154 7
  ENSMUSG00000093015  ENSMUSG00000093015  Gm22463 TSS79849    1:5644644-5644745   0   1
  ENSMUSG00000025905  ENSMUSG00000025905  Oprk1   TSS15316,TSS3878,TSS6226,TSS65522   1:5588492-5606131   0   6
  ENSMUSG00000033774  ENSMUSG00000033774  Npbwr1  TSS69693    1:5913706-5917398   0   8
  ENSMUSG00000033793  ENSMUSG00000033793  Atp6v1h TSS4651 1:5083172-5162549   24.2386 9
  ENSMUSG00000087247  ENSMUSG00000087247  Fam150a TSS42747    1:6359330-6394731   0.502804    1
  </pre>
  
  <p>I would like to group by the first 3 columns, and keep columns 4 and 5 in my output (best would be the first row of each repeated columns 1 to 3) and then calculate the mean of the numeric columns at the end. I have written this:</p>
  
  <pre><code>import pandas as pd
  df = pd.read_table('grouping.txt')
  grouped = df.groupby(list(df.columns[0:3]), sort=False).mean()
  </code></pre>
  
  <p>The output is:</p>
  
  <pre>
  tracking_id gene_id gene_short_name FPKM-1  FPKM-2
  ENSMUSG00000025902  ENSMUSG00000025902  Sox17   3.167191    104.4
  ENSMUSG00000096126  ENSMUSG00000096126  Gm22307 12.66666667 2.666666667
  ENSMUSG00000088000  ENSMUSG00000088000  Gm25493 0   1
  ENSMUSG00000098104  ENSMUSG00000098104  Gm6085  0.0743559   6
  ENSMUSG00000033845  ENSMUSG00000033845  Mrpl15  79.1154 7
  ENSMUSG00000093015  ENSMUSG00000093015  Gm22463 0   1
  ENSMUSG00000025905  ENSMUSG00000025905  Oprk1   0   6
  ENSMUSG00000033774  ENSMUSG00000033774  Npbwr1  0   8
  ENSMUSG00000033793  ENSMUSG00000033793  Atp6v1h 24.2386 9
  ENSMUSG00000087247  ENSMUSG00000087247  Fam150a 0.502804    1
  </pre>
  
  <p>The above is an output but is missing columns 4 (TSS) and 5 (locus) of the input file. How can I retain those 2 columns (their values are different and hence cant be part of the groupby columns. Keeping ANY of the values of the columns is OK with me, as long as one of the grouped by is there).</p>