I have a table of work experiences where each row represents a job in chronological order from the first job to the most recent job. For data science purposes I'm trying to create a new table based on this table that displays new job attributes and old job attributes on the same row. For example, the original table would be like:
| uniqueID | personID | startdate | enddate | title | functions |
|---|---|---|---|---|---|
| 1 | A1 | 1/1/21 | 12/1/21 | Analyst | data science |
| 2 | A1 | 1/1/22 | 12/1/22 | Manager | admin |
The new table would be something like this:
| uniqueID | personID | new_title | new_function | old_title | old_function |
|---|---|---|---|---|---|
| 1 | A1 | Analyst | data science | nan | nan |
| 2 | A1 | Manager | admin | Analyst | data science |
I tried to use some groupby variations but haven't been able to get this result.