title: Pandas - Calculate expected frequency table
body: <p>Consider the following dataframe:</p>
  <pre><code>data = [[1, 2, 3, 4], [4, 3, 2, 1]] 
  df = pd.DataFrame(data, columns = ['A', 'B', 'C', 'D'])
  </code></pre>
  <p>What would be the most efficient way to generate an expected frequency table? i.e. for each cell value compute the result of <code>(row total * column total) / (total sum)</code></p>
  <p>So that the final dataframe is:</p>
  <pre><code>data = [[2.5, 2.5, 2.5, 2.5], [2.5, 2.5, 2.5, 2.5]] 
  df = pd.DataFrame(data, columns = ['A', 'B', 'C', 'D'])
  </code></pre>