0

I have a table that I pulled from a SQL query:

acctNo structuredData Value orderId
1000 Delivery Date 10/18/2022 9999
1000 Pickup Confirmed Confirmed 9999
1000 Order Signed True 9999
1000 Delivery Date 10/14/2022 9998
1000 Pickup Confirmed Denied 9998
1000 Order Signed False 9998
1001 Delivery Date 10/22/2022 9997
1001 Pickup Confirmed Denied 9997
1001 Order Signed False 9997

I want to transpose the structured data column into multiple columns with the value being that which is stored in the value column:

acctNo Delivery Date Pickup Confirmed Order Signed orderId
1000 10/18/2022 Confirmed True 9999
1000 10/14/2022 Denied False 9998
1001 10/22/2022 Denied False 9997

How would I go about doing this?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Jimmy O
  • 1
  • 1
  • `df.pivot(index=['acctNo', 'orderId'], columns='structuredData', values='Value').reset_index()` – mozway Oct 18 '22 at 20:51

0 Answers0