I have a dataframe with these values:
filename, keyword, page
A, red, 1
A, red, 2
A, green, 1
B, red, 1
B, green, 1
C, green, 2
How can I transform this to the following format?
filename, keywords, pages
A, [red, green], [1,2]
B, [red, green], [1]
C, [green], [2]
Is there an easy way to do this in Pandas? If a list isn't allowed as a cell value, is there another datatype that I could use that Pandas would allow? Or an alternative to a Pandas dataframe that I could store this in and then save it to a csv?