Get a vocabulary (unigrams) of a column in a DataFrame. Pandas

Viewed 44

Hello i have this Dataset

      id    cuisine                  ingredients                                    processed ingredients
0   10259   greek   [romaine lettuce, black olives, grape tomatoes...   romaine lettuce black olives grape tom...
1   25693   southern_us [plain flour, ground pepper, salt, tomatoes, g...   plain flour ground pepper salt toma...
2   20130   filipino    [eggs, pepper, salt, mayonaise, cooking oil, g...   eggs pepper salt mayonaise cooki...
3   22213   indian  [water, vegetable oil, wheat, salt] water vegetable oil wheat salt
4   13162   indian  [black pepper, shallots, cornflour, cayenne pe...   black pepper shallots cornflour cay...
... ... ... ... ...
39769   29109   irish   [light brown sugar, granulated sugar, butter, ...   light brown sugar granulated sugar but...
39770   11462   italian [KRAFT Zesty Italian Dressing, purple onion, b...   kraft zesty italian dressing purple onion...
39771   2238    irish   [eggs, citrus fruit, raisins, sourdough starte...   eggs citrus fruit raisins sourdough...
39772   41882   chinese [boneless chicken skinless thigh, minced garli...   boneless chicken skinless thigh minced ga...
39773   2362    mexican [green chile, jalapeno chilies, onions, ground...   green chile jalapeno chilies onions ...

What i want is to take the vocabulary (unigrams) of each cuisine in a dataframe with 2 columns. I tried to explode the column ingredients and then groupby the cuisine but it doesn't work. Does anybody have to suggest something?

0 Answers
Related