A pandas dataframe :
>>> df
sales net_pft
STK_ID RPT_Date
002138 20140930 3.325 0.607
20150930 3.619 0.738
20160930 4.779 0.948
600004 20140930 13.986 2.205
20150930 14.226 3.080
20160930 15.499 3.619
600660 20140930 31.773 5.286
20150930 31.040 6.333
20160930 40.062 7.186
Just want to know how to get the output as the each row's value is divided by its first row of each group, like this:
sales net_pft
STK_ID RPT_Date
002138 20140930 1.000 1.000
20150930 1.088 1.216
20160930 1.437 1.562
600004 20140930 1.000 1.000
20150930 1.017 1.397
20160930 1.108 1.641
600660 20140930 1.000 1.000
20150930 0.977 1.198
20160930 1.261 1.359
Thanks,