How can I display the average time for each department for each stage as a dataframe?
I have data with departments, the stages of deals and time between stages. I want to display the average time it takes for each stage, in each department
This is my frame:
         Department      stage_deal   time
    0      Retail         Begin        0
    1      Retail         Signed       5
    2      Retail         Closed       10
    3      Finance         Begin        0
    4      Finance        Signed       40
    5      Finance        Closed       70
The following commands work:
df.groupby(['Department', 'stage_deal')]['time'].mean().to_frame()
I am getting that output:
                              ** time**
**Department      stage_deal**   
Retail          Begin             0
                Signed            5
                Closed            10
Finance         Begin             0
                Signed            40  
                Closed            70
Can you please tell me how can I convert it to the following form?:
         Retail          Finance
Begin      0                0
Signed     5               40
Closed     10              70
 
    