I am completely new to programming and started learning Python recently.
I have a pandas data frame df as shown in image 1 and trying to rearrange the columns as shown in image 2.
Can you please help me to complete this.


Thanks and Regards, Arya.
I am completely new to programming and started learning Python recently.
I have a pandas data frame df as shown in image 1 and trying to rearrange the columns as shown in image 2.
Can you please help me to complete this.


Thanks and Regards, Arya.
You can use pd.pivot_table like this:
df=pd.DataFrame({'index':[0,1,2,0,1,2],'Name':['A','A','A','B','B','B'],'Value':[10,20,30,15,25,35]})
df.pivot_table(index='index',columns='Name',values='Value').reset_index()
Out[8]: 
Name  index   A   B
0         0  10  15
1         1  20  25
2         2  30  35
