I have a table something like below. I would like to denormalize one of the column's value into columns and also would like to remove NaN and merge into single row for each UID.
| UID | Field | Value |
|---|---|---|
| 1122334455 | txnId | 1234 |
| 1122334455 | name | ABC |
| 1122334455 | age | 23 |
| 5511336677 | txnId | 2345 |
| 5511336677 | name | XYZ |
| 5511336677 | age | 48 |
| 5511336677 | city | Orlando |
| 9911334488 | txnId | 4567 |
| 9911334488 | name | DEF |
| 9911334488 | age | 17 |
| 9911334488 | city | Toronto |
| 9911334488 | country | Canada |
I would like to create pandas.DataFrame in Python which should return a table as follows:
| UID | txnId | name | age | city | country |
|---|---|---|---|---|---|
| 1122334455 | 123 | ABC | 23 | ||
| 5511336677 | 2345 | XYZ | 48 | Orlando | |
| 9911334488 | 4567 | DEF | 17 | Toronto | Canada |
Thanks for the help!