You may have to convert your dict such that the keys are values and vice versa.
dd = {
'a' :['type 2', 'type 3'],
'b' : ['type 4', 'type 5'],
'c': ['type 6', 'type 7']
}
ddd = {l:v for v,k in dd.items() for l in k}
print(ddd)
Out:
{'type 2': 'a',
'type 3': 'a',
'type 4': 'b',
'type 5': 'b',
'type 6': 'c',
'type 7': 'c'}
Now you can map it easily.
df.col1.map(ddd)
Out:
0 a
1 a
2 b
3 b
4 c
5 c
Name: col1, dtype: object
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…