Home > Back-end >  Need to get the specific data from a column and to transpose them to the rows using Python & Pandas
Need to get the specific data from a column and to transpose them to the rows using Python & Pandas

Time:11-11

Help me to attain the output using Python and Pandas
Input:

Name1
Sn1
nois
gif
quip
Date
Dur
Res
Name2
Sn2
nois
on
quipe
Date
Dur
Res

Expected Output:

Name1   Sn1 nois    gif quip    Date    Dur Res
Name2   Sn2 nois    on  quipe   Date    Dur Res

CodePudding user response:

Try with reshape

out = pd.DataFrame(df.values.reshape(-1,8))
Out[72]: 
       0    1     2    3      4     5    6    7
0  Name1  Sn1  nois  gif   quip  Date  Dur  Res
1  Name2  Sn2  nois   on  quipe  Date  Dur  Res
  • Related