I've got a simple DataFrame and a dictionary like:
import pandas as pd
dict = {'x' : ['a', 'c'], 'y': ['b', 'd']}
df = pd.DataFrame({'col1': {0: 'a', 1: 'b', 2: 'c', 3:'d'}})
col1
0 a
1 b
2 c
3 d
Now I want to do "reverse-mapping" on the dictionary to have another 'col2', and the DataFrame like this:
col1 col2
0 a x
1 b y
2 c x
3 d y
Thank you for help!