Python, NLP, Spacy.
for all data in the "categories" column to a list Join all lists together Create a set from all lists (to reduce duplicate entries) Create the dictionary with a dictionary comprehension for each entry of the list Considering all of these aspects, the final functions is as follows: def