title: How to generate a frequency table from a dataframe?
body: <p>I have a df with raw survey data similar to the following with 12000 rows and forty questions. All responses are categorical</p>
  
  <pre><code>import pandas as pd
  
  df = pd.DataFrame({'Age' : ['20-30','20-30','30-45', '20-30','30-45','20-30'],
                     'Gender' : ['M', 'F', 'F','F','M','F'],
                     'Income' : ['20-30k', '30-40k', '40k+', '40k+', '40k+', '20-30k'],
                     'Question1' : ['Good','Bad','OK','OK','Bad','Bad'],
                     'Question2' : ['Happy','Unhappy','Very_Unhappy','Very_Unhappy','Very_Unhappy','Happy']})
  </code></pre>
  
  <p>I  want to categorize the responses to each question according to Age, Gender and Income, to produce a frequency (by %) table for each question that looks like this <a href="https://i.stack.imgur.com/1sBGk.png" rel="nofollow noreferrer">screenshot showing questions</a>.</p>
  
  <p><a href="https://i.stack.imgur.com/1sBGk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1sBGk.png" alt="enter image description here"></a></p>
  
  <p>Crosstab produces too many categories ie it breaks down by income and within income, by age etc. So I'm not sure how best to go about this. I'm sure this is an easy problem but I'm new to python to any help would be appreciated</p>