Home > Back-end >  How to up value in new column, when occur 0?
How to up value in new column, when occur 0?

Time:02-23

I have this df:

data = {'Name': ['T', 'J', 'K', 'J', 'M', 'A', 'J', 'K','L', 'o', 'j' ], 'Match': [0,1,2,0,1,0,1,2,3,0,1]}

Df =  pd.DataFrame(data)

I want to apply column, which show season for each match. Season sholud be more then previous every time when match value is 0. What is important, number of matches in every season is different.

Out sholud be:

enter image description here

  • Related