Working with the following python pandas dataframe df:
df = pd.DataFrame({'transaction_id': ['A123','A123','B345','B345','C567','C567','D678','D678'],
'product_id': [255472, 251235, 253764,257344,221577,209809,223551,290678],
'product_category': ['X','X','Y','Y','X','Y','Y','X']})
transaction_id | product_id | product_category
A123 255472 X
A123 251235 X
B345 253764 Y
B345 257344 Y
C567 221577 X
C567 209809 Y
D678 223551 Y
D678 290678 X
I need to add another column "transaction_category", which looks at the transaction_id and which product categories are in the transaction_id.
This is the output I am looking for: