Assume I have df and d below. I want to, for each row in col, check if there is a match with an item key in d, and if so replace the value in col with the corresponding item value, otherwise drop that row. (There can't be more than one match).
df = pd.DataFrame({'col': ['sdffzdhellojkh', 'fegky', 'ouewfzdworldqf']})
d = {'fzdhello': 'hello', 'fzdworld': 'world'}
The output in this case would look like:
df
col
0 hello
1 world