'Python Barplot for multiple groupby
I want to make a barplot of a groupby made with 2 columns. I managed to make the chart with the following code:
df = pd.DataFrame({"error": ['erreur_qt', 'ref_absentes', 'erreur_qt', 'ref_absentes'],
"100374578": [363, 290, 154, 521],
"100374579" : [382, 169,584, 210],
"100374583": [213, 262, 120, 220],
"date": ['2022.05.02', '2022.05.02', '2022.05.05', '2022.05.05']
})
data = df.groupby(['date','error']).sum()
data.plot.bar(stacked=True)
But it does not suit me because I would like the bars with the same date to be side by side. Here an image of what I would like :
Can you help me?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|