title: Complicated separation from column in Python
body: <p>I have a dataframe, df, where I would like specific separations of values within my column to display percentages. I would like the <strong>first  'word' that is separated by '-'</strong> <strong>and its #T value. ex. (12T)</strong> Essentially I would be grouping the Type <em><strong>if the first word matches</strong></em>, <strong>as well as its #T</strong> (ex.12T, 50T etc)  Some of the #T values look like this: <em><strong>6.4T</strong></em> , and some of the 'first' words look like: <strong>AY14.5</strong></p>
  <p><em><strong>UPDATED</strong></em></p>
  <pre><code>There are        2  unique counts    of   Hello-HEL-HE-A6123-123A-12T
                   2  unique counts    of   Hello-HEL-HE-A6123-123A-50T
                   1  unique count(s)  of   Happy-HAP-HA-R650-570A-90T
                   2  unique counts    of   Kind-KIN-KI-T490-NET_14T-A.0
                   2  unique counts    of   AY14.5-fyy-FY-R770-256G-6.4T-R1-v.A
  </code></pre>
  <p><strong>Data:</strong></p>
  <pre><code>Type
  
  Hello-HEL-HE-A6123-123A-12T_TYPE-v.A    
  Hello-HEL-HE-A6123-123A-12T_TYPE-v.E    
  Hello-HEL-HE-A6123-123A-50T_TYPE-v.C    
  Hello-HEL-HE-A6123-123A-50T_TYPE-v.A    
  Happy-HAP-HA-R650-570A-90T_version-v.A  
  Kind-KIN-KI-T490-NET_14T-A.0
  Kind-KIN-KI-T490-NET_14T-A.0       
  AY14.5-fyy-FY-R770-256G-6.4T-R1-v.A
  AY14.5-fyy-FY-R770-256G-6.4T-R1-v.A
  </code></pre>
  <p><strong>Desired:</strong></p>
  <pre><code>Type                                    Percent
  
  Hello    12T                        22.2%
  Hello    50T                        22.2%
  Happy    90T                        11.1%
  Kind     14T                        22.2%
  AY14.5   6.4T                       22.2%                 
  </code></pre>
  <p><strong>Doing:</strong></p>
  <pre><code>df=df.assign(Type=df.Type.str.split('_').str[0]) df2= 
  (df['Type'].value_counts(normalize=True)*100).to_frame('%') 
  print(df2.rename_axis(index='Type'))
  </code></pre>
  <p>However, my <em><strong>output is showing the full Type (name)</strong></em>, and it is <em><strong>excluding cases where the '_' comes
  before the #T  (ex. 12T)</strong></em></p>
  <pre><code>Type     
                           
  Hello-HEL-HE-A6123-123A-12T 
  </code></pre>
  <p>Any suggestion is appreciated, I am still troubleshooting.</p>
  <p><em><strong>UPDATED</strong></em></p>
  <p><strong>Desired:</strong></p>
  <pre><code>Type                                    Percent
  
  Hello    12T                        22.2%
  Hello    50T                        22.2%
  Happy    90T                        11.1%
  Kind     14T                        22.2%
  AY14.5   6.4T                       22.2%        
  </code></pre>