How to draw a graphical count table in pandas
<p>I have a dataframe df with two columns <code>customer1</code> and <code>customer2</code> which are string valued.  I would like to make a square graphical representation of the count  number for each pair from those two columns.   </p>

<p>I  can do</p>

<pre><code>df[['customer1', 'customer2']].value_counts()
</code></pre>

<p>which will give me the counts.  But how can I make something that looks a little like:</p>

<p><a href="http://i.stack.imgur.com/GZ6yI.png" rel="nofollow"><img src="http://i.stack.imgur.com/GZ6yI.png" alt="enter image description here"></a> </p>

<p>from the result?</p>

<p>I can't provide my real dataset  but here is a toy example with three labels in csv.</p>

<pre><code>customer1,customer2
a,b
a,c
a,c
b,a
b,c
b,c
c,c
a,a
b,c
b,c
</code></pre>

<p>As @MaxU mentioned, <code>seaborn.heatmap</code> should work. It appears that you can use the Pandas DataFrame as the input.</p>

<p><code>seaborn.heatmap(data, vmin=None, vmax=None, cmap=None, center=None, robust=False, annot=None, fmt='.2g', annot_kws=None, linewidths=0, linecolor='white', cbar=True, cbar_kws=None, cbar_ax=None, square=False, ax=None, xticklabels=True, yticklabels=True, mask=None, **kwargs)</code></p>

<p><a href="https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.heatmap.html#seaborn.heatmap" rel="nofollow">https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.heatmap.html#seaborn.heatmap</a></p>

python pandas