更新时间:2023-11-18 21:59:16
要准确匹配您可以执行的所需输出
To match the exact desired output you could do
df['aux'] = df.groupby('rep').cumcount()
df.pivot(index='aux' ,columns='rep', values='student_id')
输出:
rep 1 2
aux
0 abc100 abc101
1 abc102 abc103
2 abc104 abc105
3 abc106 abc107