I have a dataframe that looks like this. enter image description here I would like to add a column tile that looks like this enter image description here is numpy tile the correct tool for this? Ultimately what I am trying to do is count the month gaps each person has between the CRP event. So up until there is an event, the event is null. That would be a zero. When the next event happens, the tile would be 1. then the next few events if null would be a 1 until another event happens. if there is another CRP in consecutive order, that would trigger a new tile i.e. 3 if the previous was 2. Thanks EDIT: The tile is supposed to start over per member. I forgot that important detail. So I will try to use the cumsum() with a window. Continue reading...