title: Pandas correlation matrix with value_counts column of strings
body: <p>I want to create a correlation matrix from string columns value counts. So here I have Accident severity and Time.
  I am trying to show the correlation between the Time of day and the severity of an accident </p>
  
  <p>Part of the Pandas dataframe (df) :</p>
  
  <pre><code>+-----------------------+-------------------+------------------+
  | Accident_Index        | Time              | Accident_Severity|
  +-----------------------+-------------------+------------------+
  | 200501BS00001         | Morning           | Serious          |
  | 200501BS00002         | Night             | Slight           |
  | 200501BS00003         | Evening           | Slight           |
  | 200501BS00004         | Afternoon         | Fatal            |
  +-----------------------+-------------------+------------------+
  </code></pre>
  
  <p>My expected Output is something like this:</p>
  
  <pre><code>+---------+-----------+-------+---------+-----------+
  |         |   Morning | Night | Evening | Afternoon |
  +---------+-----------+-------+---------+-----------+
  | Serious |       0.9 |   0.3 |     0.3 |       0.3 |
  | Slight  |       0.8 |     1 |     0.2 |       0.5 |
  | Fatal   |       0.4 |   0.3 |       1 |       0.3 |
  +---------+-----------+-------+---------+-----------+
  </code></pre>
  
  <p>I have Tried this sort of thing:</p>
  
  <pre><code>s_corr = df.Accident_Severity.str.get_dummies(' ').corrwith(df.Time.value_counts() / df.Time.value_counts().max())
  print(s_corr)
  </code></pre>
  
  <p>Output: </p>
  
  <ul>
  <li>Fatal     NaN</li>
  <li>Serious   NaN</li>
  <li>Slight    NaN</li>
  </ul>
  
  <p>and this:</p>
  
  <pre><code>corrs = df.pivot('Time','Accident_Severity').T.corr().stack()
          corrs.index.names = 'Time', 'Accident_Severity'
          corrs.reset_index()
  print(corrs)
  </code></pre>
  
  <p>Output:</p>
  
  <ul>
  <li>ValueError: Index contains duplicate entries, cannot reshape</li>
  </ul>
  
  <p>and this:</p>
  
  <pre><code>corrs = df.reset_index().pivot_table('Time','Accident_Severity').T.corr().stack()
  print(corrs)
  </code></pre>
  
  <p>Output:</p>
  
  <ul>
  <li>pandas.core.base.DataError: No numeric types to aggregate</li>
  </ul>
  
  <p>and this:</p>
  
  <pre><code>acc = df['Accident_Severity'].value_counts()
  ti = df['Time'].value_counts()
  print(acc.corr(ti))
  </code></pre>
  
  <p>Output:</p>
  
  <ul>
  <li>nan</li>
  </ul>