title: How to get the frequency table for two columns of a dataframe
body: <p>I have the following dataframe:</p>
  <pre><code>data = {'ps_variable_1': ['Top 33%', 'Bottom 33%', 'Middle 33%', 'Bottom 33%', 'Middle 33%',
                            'Top 33%', 'Top 33%', 'Bottom 33%', 'Bottom 33%'],
          'ps_variable_2': ['Middle 33%', 'Middle 33%', 'Middle 33%', 'Top 33%', 'Bottom 33%',
                            'Bottom 33%', 'Bottom 33%', 'Middle 33%', 'Top 33%']}
  df = pd.DataFrame(data)
  
     ps_variable_1 ps_variable_2
  0        Top 33%    Middle 33%
  1     Bottom 33%    Middle 33%
  2     Middle 33%    Middle 33%
  3     Bottom 33%       Top 33%
  4     Middle 33%    Bottom 33%
  5        Top 33%    Bottom 33%
  6        Top 33%    Bottom 33%
  7     Bottom 33%    Middle 33%
  8     Bottom 33%       Top 33%
  </code></pre>
  <p>I want to get a new dataframe out of it with 3 columns: Top 33% Middle 33% Bottom 33%. Each column has 3 rows as below:</p>
  <pre><code>               Top 33%     Middle 33%   Bottom 33%
  Top 33%         
  Middle 33%          
  Bottom 33%          
  </code></pre>
  <p>For each grid cell, I want to count the number of occurrences based on the dataframe above. E.g. the first row contains the number of cases where ps_variable_1 is in the top 33% or top third-percentile, and the respective number of cases where ps_variable_2 is in the top third, middle third and bottom third percentile respectively. How do I do that, I would prefer a solution which can be extended to other ratios as well e.g. top 20%....</p>