I have a dataframe with 4 columns. I want to add a column that will give running total by a group. I know how to do that in pandas( i.e cumcount +1 with groupby) but I want to move the data into numpy array and vectorize the operation. Example input data
Example output data with total # of complaints: