Q:

Plotting bar charts for multi level groupby dataframe

Using the groupby method
    df = Al[['Connection Name','UAS-RS', 'SES-RS', 'OFS-RS', 'ES-RS', 'BBE-RS', 'Date', 'Alarm Type']]
    cols = ['Connection Name', 'Date', 'Alarm Type']

    df.mask(df == 0, np.nan).groupby(cols)[['UAS-RS', 'SES-RS', 'OFS-RS', 'ES-RS', 'BBE-RS']].count()

I got the following table:

The initial table had the this king of structure:
       | ConName |   Date   | Alarm | ETH1 | ETH2 | ETH 3|
       | AR21    | 25-01-19 |  AL1  |   1  |   0  |   3  |  
       | AR22    | 25-01-19 |  AL2  |   0  |   0  |   1  |
       | AR23    | 26-01-19 |  AL1  |   1  |   1  |   0  |  
       | AR21    | 26-01-19 |  AL2  |   0  |   1  |   0  |  

The problem
I want to build barplots for each connection name depicting distribution of features between two Alarm Types.
What I get:

The desired output:

My last code for building plot only for one connection name:
for date in df[df['Connection Name']=='AR-CY18 A2.5G-RTA33']['Date']:
    df.mask(df == 0, np.nan).groupby('Alarm Type')[['UAS-RS', 'SES-RS', 'OFS-RS', 'ES-RS', 'BBE-RS']].count().plot(kind='bar',stacked=True,subplots=True)

Also, the problem is, that the script builds multiple plots by date (I interrupted kernel on the 77th plot) with the identical output.
What am I doing wrong? unstacking (unstack().plot.barh()) also didn't help.
Any clues are welcome.

A:

It looks like you are trying to produce a plot for each (date, conName). Here's what I would do:
for (dt, con), d in df.groupby(['Date','ConName'], group_keys=False):
    fig,ax = plt.subplots()
    d.groupby('Alarm')[['ETH1','ETH2']].count().plot.bar(ax=ax)
    ax.set_title(con)

Output will be several plots like this, where 2 is the conName:

