'Python Groupby Plot for multiple colums in Dataframe and multiple plots in a graph

I want to plot a graph for n users and the plot will be in one graph. The plot will be in the way like:

User1 plot,
User1+user2 plot,
User1+user2+ user+3 plot

I have grouped data by using groupby data.groupby(['time','username'])['memory_usage'].sum(). reset_index()

After groupby I got groups but I want at each time among those 3 users the graph will be plotted in this way:

User1 plot -1st plot in bottom
User1+user2 plot-2nd plot 
User1+user2+ user3 - 3rd plot

|TIME | USERNAME | MEMORY_USAGE |
|-------------------------------|
|18:44| user1    |    0         |
|18:44| user2    | 1545246      |
|18:44| user3    | 165646       |
|18:46| user1    |    0         |
|18:46| user2    | 6564478      |
|18:46| user3    | 164875       |

enter image description here

I need to plot graph in a way that:

user 1 plot
user2 plot will be like user1 +user2(0+1545246)
user3 plot will be like user1 +user2+user3(0+1545246+165646)

Sample plot I showed in picture I uploaded.

I have a problem plotting this graph.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source