title: Groupby Two Columns - Pareto of combinations
body: <p>I am fairly new to python. I have searched for an answer to this question, but am afraid I do not know the correct keywords to find it if it already exists. </p>
  
  <p>I have a pandas df that consists of a column of serial numbers and some parameters that they possess. Example: SN1 has parameters A and B, SN2 has parameters A and C, etc.</p>
  
  <pre><code>Serial        Parameter  
  SN1              A
  SN1              B
  SN2              C
  SN2              B
  SN3              D
  SN4              A 
  SN4              B 
  SN5              D
  </code></pre>
  
  <p>When I execute df.groupby([Serial, Parameter]).sum(), I produce a new table that removes the duplicates in 'Serial' and gives a clearer picture of which SN contains what combination of parameters. </p>
  
  <pre><code>Serial      Parameter
  SN1         A 
              B
  SN2         A
              C
              B
  SN3         D
  SN4         A 
              B
  SN5         D 
  </code></pre>
  
  <p>I am interested in producing a new table out of this that shows a count for all the combinations of parameters that occur in my dataframe, so that I can produce a bar graph showing which combination occurs the most to the lesast.</p>
  
  <p>I imagine it would look something like this, where 'Combination #' is a new added column to index each combination of parameters. 'Combination Count' is also a added column that is the count for the frequency of that index a nd Parameter combination remains and simply shows what combination the combination is. </p>
  
  <pre><code> Combination #       Combination Count  Parameter 
      1                  2                  A
                                            B
                                            C
      2                  2                  D 
      3                  1                  A
                                            C
                                            B      
  </code></pre>
  
  <p>Do I have the correct approach even to be using groupby? Some tips would be helpful. </p>
  
  <p>Thanks!</p>
  
  <p>EDIT: For clarity of the ask. </p>