I have a data frame as shown below
Unit_ID             Unit_Create_Year
1                   2011
2                   2011
3                   2012
4                   2014
5                   2012
6                   2015
7                   2017
8                   2017
9                   2019
From the above data frame I would like to prepare below data frame
Expected Output:
Year         Number_of_Unit_Since_Year       List_of_Units
2011         2                               [1,2]
2012         4                               [1,2,3,5]
2013         4                               [1,2,3,5]
2014         5                               [1,2,3,5,4]
2015         6                               [1,2,3,5,4,6]
2016         6                               [1,2,3,5,4,6]
2017         8                               [1,2,3,5,4,6,7,8]
2018         8                               [1,2,3,5,4,6,7,8]
2019         9                               [1,2,3,5,4,6,7,8,9]
if a unit is created in 2011 it should be counted for all next years.
Steps: In 2011 two unit created '1' and '2'. In 2012 two unit created '3' and '5'. So in in 2012 will have total 4 units including the units in 2011.
 
    
 
     
    