groupby counter of rows
问题 I am trying to create a new variable which counts how many times had been seen the same id over time. Need to pass from this dataframe id clae6 year quarter 1 475230.0 2007 1 1 475230.0 2007 2 1 475230.0 2007 3 1 475230.0 2007 4 1 475230.0 2008 1 1 475230.0 2008 2 2 475230.0 2007 1 2 475230.0 2007 2 2 475230.0 2007 3 2 475230.0 2007 4 2 475230.0 2008 1 3 475230.0 2010 1 3 475230.0 2010 2 3 475230.0 2010 3 3 475230.0 2010 4 to this id clae6 year quarter new_variable 1 475230.0 2007 1 1 1