Plotting a type of Histogram
<p>I have data in the following format</p>

<pre><code>0   0.69
1   0.87
1   0.87
0   0.87
0   0.87
</code></pre>

<p>So the first column is either zero or one. Second column is a decimal number. If you look at the table, at 0.69, there is only one zero and no ones. Also at 0.87, there are two zeros and two ones. I want to plot it so that the x-axis is the decimal number. Y-axis has two plots. One will be number of zeros at that decimal number and the other is the number of ones. Also assume that I have this table in pandas dataframe format. </p>

<p>use <code>groupby</code>, <code>size</code>, and <code>unstack</code></p>

<pre><code>df.groupby([0, 1]).size().rename_axis([None, None]).unstack(0).plot.bar()
</code></pre>

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

python pandas numpy histogram