I have a requirment to group rows preceeding by 0 in column A and sum up the values in column B. For rows that are not prceeded by 0, print the same in output. How can i acheive this using pandas dataframe. I have given sample grouping with expected output in the attached screenshot. even if there are rows 20 preceding rows it should group

Reproducible input:
df = pd.DataFrame({'Column A': [0,0,1,1,1,0,-1,-1,0,0,0,1,0,0,0,0,-1],'Column B': [5,3,4,2,1,3,7,5,10,2,3,4,5,5,5,5,5] })