Keeping the last duplicate index during a column pivot?

Given a DataFrame:

df = pd.DataFrame([{'i':0 if random.random()<.5 else random.random(),'a':['abc','def','ghi','jkl'][int(random.random()*4)],'b':random.random(),'c':random.random()} for _ in range(20)])
df.i = df.i.cumsum()
df = df.set_index('i')

            a         b         c
i                                
0.000000  ghi  0.857628  0.856835
0.011049  abc  0.000408  0.189136
0.111914  ghi  0.785439  0.716488
0.111914  abc  0.168402  0.177056
0.111914  ghi  0.757416  0.763886
0.111914  ghi  0.807576  0.339000
0.574349  abc  0.508411  0.386711
0.574349  abc  0.347667  0.511798
0.650300  def  0.428700  0.176682
0.947907  def  0.308117  0.413609
1.503684  jkl  0.020903  0.974225
1.503684  jkl  0.836817  0.609914
1.659698  jkl  0.002263  0.508951
1.673570  jkl  0.552632  0.208657
1.673570  ghi  0.424978  0.573951
2.497983  jkl  0.657852  0.896766
2.994696  jkl  0.768899  0.988074
3.165982  def  0.848905  0.803382
3.480295  jkl  0.539529  0.772906
3.548527  abc  0.534413  0.974576

I'd like to keep only the last duplicate index entry while doing a:

df.pivot(columns='a')

Note that, for example, i=0.111914 has values for both then all four of the intended MultiIndex columns for 'ghi' and 'abc' that must share a row with the common index i=0.111914 .

However, this is not permitted as there is no option for the pivot method such as:

df.pivot(columns='a', keep='last')
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum