title: How can I find the most frequent two-column combination in a dataframe in python
body: <p>I have my data in pandas data frame as follows:</p>
  
  <pre><code>df = pd.DataFrame({'a':[1,2,3,3,4,4,4], 'b':[2,3,4,4,5,5,5]})
  </code></pre>
  
  <p>So the dataframe looks like this:</p>
  
  <pre><code>   a  b
  0  1  2
  1  2  3
  2  3  4
  3  3  4
  4  4  5
  5  4  5
  6  4  5
  </code></pre>
  
  <p>The column 'a','b' combination here are: 12(1), 23(1), 34(2), 45(3).
  I am trying to select 4 and 5 and print them out because their combination has
  most occurrences (3 times). </p>
  
  <p>My code is:</p>
  
  <pre><code>counts = df.groupby(['a','b']).size().sort_values(ascending=False)
  print(counts)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>a  b
  4  5    3
  3  4    2
  2  3    1
  1  2    1
  dtype: int64
  </code></pre>
  
  <p>But this only gives me a column [3,2,1,1]. This are the numbers combination counts.
  How can I access elements 4 and 5 individually so I can print them out?</p>
  
  <p>Thanks in advance!</p>