title: Pandas Groupby using multiple criteria on different axis
body: <p>I have a <code>df</code> DataFrame like : </p>
  
  <pre><code>      | A | B | A_ | B_ |COMMON|
  --------------------------------
  0     | 1 | 3 | 0  | 1  | a    |
  --------------------------------
  1     | 8 | 5 | 4  | 0  | a    |
  --------------------------------
  2     | 3 | 6 | 2  | 4  | b    |
  --------------------------------
  3     | 9 | 9 | 1  | 7  | b    |
  </code></pre>
  
  <p>And I want to group all columns <code>X</code> with <code>X_</code> for all letters <code>A,B,...</code> (let's say, the group is called <code>X</code> as well), and group as well using <code>COMMON</code>. I would like to apply later function like <code>std()</code> to all the grouped values.</p>
  
  <p>So the result would look like: </p>
  
  <pre><code>COMMON  |  A     |  B     |
  ---------------------------
  a       |std(...)|std(...)|
  ---------------------------
  b       |std(...)|std(...)|
  </code></pre>
  
  <p>I have been able to group either one or the other, using <code>df.groupby(['COMMMON'])</code> for one criteria and <code>.groupby(mapping_function, axis=1)</code> for the other one, but how do I use them together? </p>
  
  <p>Another alternative for an intermediate step would be to concatenate individual columns so that I would get: </p>
  
  <pre><code>      | A | B |COMMON|
  ----------------------
  0     | 1 | 3 |a    |
  ---------------------
  1     | 8 | 5 |a    |
  ---------------------
  2     | 3 | 6 |b    |
  ---------------------
  3     | 9 | 9 |b    |
  ---------------------
  0     | 0 | 1 |a    |
  ---------------------
  1     | 4 | 0 |a    |
  ---------------------
  2     | 2 | 4 |b    |
  ---------------------
  3     | 1 | 7 |b    |
  </code></pre>
  
  <p>But I also don't know how to do that. 
  Also as you might see, I don't really care about the index.</p>
  
  <p>Thank you for your help!</p>