I have a data frame similar to this one, I would like to get the cumulative sum of the column "Number" until column Name is equal to "AAAA". So basically, I would like to get the cumulative sum of the column 'Number' between each 'AAAA'. So the sum starts again each time we have 'AAAA' in the column. Is there a way I can do that?
data = {'Name': ['AAAA','B','C','D','E','AAAA','O','C','D','E','AAAA','D', 'C','D','E','AAAA','B','C','D','E','AAAA','L','M'],
'Number': [7,8,9,10,1,1,2,34,5,6,7,8,9,10,1,1,7,8,2,3,5,6,7]
}
df = pd.DataFrame (data, columns = ['Name','Number'])
df['Sum_Cummulative']=df['Number'].cumsum()
