Currently, I am working on grouping transactions based on a product ID. The problem is that a product can contain various alternate IDs that can be located in two columns. For example, a product can look like this in the dataset;
requested ID | Item ID |
---|---|
123t-34 | 4s4532t |
:------------ | -------: |
4s4532t. | 123t-34 |
:------------ | -------: |
123t-34. | 4s4532t |
This is an example of a much bigger dataset. Any input on how I could group them to look something similar to this;
Id. | Alternate Ids |
---|---|
123t-34 | (4s4532t,123t-34) |
This is my attempt to solve the problem.
data_dict = data.groupby('requested_id')['Item ID'].agg('unique')
But this only solved half of the grouping based on one column.