I have the following pandas dataframe:
A B
1 3
0 2
1 4
0 1
0 3
I would like to plot the frequency of B instnaces given A, something like this:
|
|
| __
B | | |
| ___ | |
| | | | |
| | | | |
|__|_|__|__|______________
A
Thus, I tried the following:
df2.groupby([df.A, df.B]).count().plot(kind="bar")
However, I am getting the following exception:
TypeError: Empty 'DataFrame': no numeric data to plot
Therefore, my question is how to plot the frequency of the elements in B given the frequency of A?.