0

I want to combine multiple rows that have common info using pandas dataframe but not sure how to do that.

My orgin dataframe:

header: No. Name    question    answer 
row 1: 1    A       Q1          A1
row 2: 1    A       Q2          A2
row 3. 1    A       Q3          A3
row 4: 2    B       Q1          BA1
row 5: 2    B       Q2          BA2
row 6: 2    B       Q3          BA3

Expected dataframe:

header: No. Name    Q1  Q2  Q3
ROW1:   1   A       A1  A2  A3
ROW2:   2   B       BA1 BA2 BA3

How can I combine the rows to get this expected result?

Georgy
  • 12,464
  • 7
  • 65
  • 73

0 Answers0