How to turn StringDataFrame:
| String |
|---|
| Jon likes {ExplodeAnimals}. |
| Jon eats {ExplodeFruit}. |
Into this:
| String |
|---|
| Jon likes Cats. |
| Jon likes Dogs. |
| Jon likes Tigers. |
| Jon likes Llamas. |
| Jon eats Apples. |
| Jon eats Pears. |
| Jon eats Bananas. |
| Jon eats Strawberries. |
Based on this ThingsDataFrame
| Thing | Type |
|---|---|
| Cats | animal |
| Dogs | animal |
| Tigers | animal |
| Llamas | animal |
| Apples | fruit |
| Pears | fruit |
| Bananas | fruit |
| Strawberries | fruit |
option 1
You can use
merge/map.Output:
option 2
probably less efficient but more versatile, using the curly bracket notation to perform brace expansion (with the
braceexpandmodule):NB. simplifying the
StringDataFrameinput to:Output:
This enables you to do funky stuff like: