Sample data frame which are strings with square brackets (like lists).
name items
['A', 'B'] ['1', 2', 3']. (data type is strings for these apparent lists)
Expected result:
dict1 = {['1', '2', '3']:['A', 'B']}
I made several attempts including converting the columns using .apply(ast.literal_eval). Still results in something like this when attempting to convert the column above using tolist():
[['A', 'B']]
Perhaps a dict cannot be created in this way given the data type for the columns is string?
Thanks for taking a look.