python – How to reshape data in Pandas DataFrame


I am working on a project where i need to reshape the data in particular Format. I have transformed successfully in Excel but how we can transformed this Data with pandas because in Excel we have the limitation of rows.

Territory ID    Patient Id  Doctor Id   Clinic Count    Attribute          Value
43                172        6021          Clinic1      Service Date      06/22/2017 
43                172        6021          Clinic1      Product               A
43                172        6021          Clinic1      Qty                   1
43                172        6021          Clinic1      Amount                80.63
43                172        6021          Clinic1      Age                   1
43                172        6021          Clinic1      Days Last Clinic      0
43                187        5658          Clinic2      Service Date       06/30/2017 
43                187        5658          Clinic2      Product               B
43                187        5658          Clinic2      Qty                   2
43                187        5658          Clinic2      Amount                52.48
43                187        5658          Clinic2      Age                   9y1m
43                187        5658          Clinic2      Days Last Clinic      23

This has to be reshape in this format:

TerritoryID PatientId   DoctorId    Clinic_Count    Service_Date    Product    Qty    Amount   Age    Days Last Clinic   
    
43            172        6021          Clinic1      06/22/2017       A           1     80.63    1          0
43            187        5658          Clinic2      06/30/2017       B           2     52.48    9y1m       23