My df looks like this:
| Index1 | Index2 | cat | art |
|---|---|---|---|
| id | 1 | 1293874 | Vintage |
| name | 1 | Sam | old |
| id | 2 | 2030039 | Retired |
| name | 2 | Ben | lacklust |
My goal is try to pivot index1 and add them as columns. Currently, my data is not structured and correctly formatted. The category column has a bucket of information of both name and id, but it is not a category. Not only do I want to group by the index, but I also want to add the columns to the dataset without removing any of the original columns.
My desired output looks like this
| Index2 | cat | name | id_Art | name_Art |
|---|---|---|---|---|
| 1 | 1293874 | Sam | Vintage | old |
| 2 | 2030039 | Ben | Retired | lacklust |