title: Python: Group by characters before second dash
body: <p>I have a string such as 'GH-TV-G090013'. Basically, I want to group a data frame by the region, which is the second pair of letters ('TV'). Right now, I have the code below. But the problem with this is that some regions are three letters and others are two (and some even are one). So it would be nice to group by the letters before the second dash (i.e. 'GH-TV'). Is there a way to do this?</p>
  
  <p>Examples right now:
  'GH-TV-G090013' becomes 'GH-TV-'
  'GH-ABC-G090011' becomes 'GH-ABC' 
  'GH-V-G090000' becomes 'GH-V-G'</p>
  
  <pre><code>df.groupby(df.columns.str[:6], axis = 1).sum()
  </code></pre>