I am working in Databricks > Python /w Pandas. I want to restrucure the data to move from:
ID | Account | Phone |
---|---|---|
1234 | 1 | 4437935470 |
1234 | 1 | 4437935470 |
1234 | 2 | 4437935472 |
1234 | 2 | 4437935473 |
1235 | 3 | 4437935474 |
1235 | 4 | 4437935475 |
1236 | 4 | 4437935476 |
1236 | 4 | 4437935477 |
To:
ID | Account | Phone 1 | Phone 2 | Phone 3 | Phone N etc. |
---|---|---|---|---|---|
1234 | 1 | 4437935470 | null/empty/etc | null/empty/etc | |
1234 | 2 | 4437935472 | 4437935473 | null/empty/etc | |
1235 | 3 | 4437935474 | null/empty/etc | null/empty/etc | |
1235 | 4 | 4437935475 | 4437935476 | 4437935477 |
Ideally, this could all be done using Pandas Dataframe functions. I have limited experience within the data world and with Python/Pandas specifically, so I would consider other options within the context of Databricks / Python approach, if needed.