How to fill the index in Pandas Pivot_table

Viewed 3143

I use pandas.pivot_table to show the following DataFrame:

A  B
a    SH     1.0
b    BJ     2.0
     SH     3.0
c    BJ    10.0
     SH     5.0

So I want to change the DataFrame to the following, I mean to fill the blanks in the index:

A  B
a    SH     1.0
b    BJ     2.0
b    SH     3.0
c    BJ    10.0
c    SH     5.0
1 Answers
Related