I have 3 column one is categorical values one is numeric and another yes and no include like this :
Column1 Column2 Column3
A 2 yes
A 1 yes
A 3 no
A 2 yes
A 5 yes
B 3 yes
B 1 no
B 2 yes
B 5 yes
I want to create new column to sum of column2 values until column3 equal to no. Then continue restart to sum of column2 elements until see any 'no' with group by column1. I want to have:
Column1 Column2 Column3 Column4
A 2 yes 3 ( sum of column2 elements until no for group A)
A 1 yes 3
A 3 no no
A 2 yes 7
A 5 yes 7
B 3 yes 3
B 1 no no
B 2 yes 7
B 5 yes 7
how can create this new column for python data frame?
Thank you so much your timing!