I am looking for an efficient way to perform the following join on two pandas.DataFrames:
The first one contains in column A strings like:
A ....
Spam|One
Spam|Two
Ham
Eggs
The second one is a reference table with string keys as the index and a text description:
index description
Spam "..."
Ham "..."
Eggs "...."
BakedBeans "...."
Each key in the index can be a prefix to a string in A. Now I'd like to join the description column to column A where the value in A matches the prefix. I have a feeling that there is an efficient pandas one-liner for it...
We can assume that all values in A have the format "prefix|suffix" or "prefix". Perhaps that can speed up things.