Q:

How to draw stacked bar plot from df.groupby('feature')['label'].value_counts()

I get a df.groupby('feature')['label'].value_counts() as follows:
X_train.groupby('reqrealip_by_pkgname_count')['label'].value_counts()

22052                       1.0      15390
                            0.0       4512
22179                       1.0      15419
                            0.0       4644
22215                       1.0      15514
                            0.0       4619
22231                       1.0      15505
                            0.0       4604
22249                       1.0      15562
                            0.0       4678
22304                       1.0      15632
                            0.0       4642
22331                       1.0      15551
                            0.0       4680
22364                       1.0      15618
                            0.0       4689
22367                       1.0      15537
                            0.0       4715
22394                       1.0      15650
                            0.0       4627
22584                       0.0      12630
                            1.0       7644
26040                       1.0      21339
                            0.0       2266
32176                       1.0      27082
                            0.0       2014

And I want to draw a stacked bar plot like this way. 
But the height of each bar in this plot is not equal.
If not mind, could anyone help me how to draw such stacked barplot? 
Thanks in advance.

A:

Use Series.unstack with DataFrame.plot.bar:
s = X_train.groupby('reqrealip_by_pkgname_count')['label'].value_counts()

If need normalize add parameter normalize to Series.value_counts and multiple by 100:
s=X_train.groupby('reqrealip_by_pkgname_count')['label'].value_counts(normalize=True).mul(100)

s.unstack().plot.bar(stacked=True)

Or:
s.unstack(0).plot.bar(stacked=True)

