0

I have below Dataframe

enter image description here

I need to reshape the dataframe to below format with product name as a primary key

enter image description here

Dataframe Code:

 import pandas as pd
 q_df=pd.DataFrame({'Product':['XYZ_1','XYZ_2','XYZ_3'],'Name': \
 ['Apple','Orange','Guava'],'Cost':[10,8,5],'Availability': \
 ['Yes','No','Yes']})

I have tried with pivoting the product as index column, but I couldn't able to apply transpose on rest of the dataframe columns.

Please pour your suggestions to get desired outcome

Raja
  • 71
  • 1
  • 11
  • Below link provides answer to above question - https://stackoverflow.com/questions/28654047/convert-columns-into-rows-with-pandas – Raja Nov 09 '21 at 11:05

0 Answers0