I have a Pandas df column 'text' like so:
| text | 
|---|
| Aztecs | 
| Apple | 
| Mayans | 
| Christopher | 
| Banana | 
| Martin | 
I have a dictionary with integer as key and list as value. For example,
d = {1023: ['Aztecs', 'Mayans'], 2213: ['Apple','Banana'], 3346: ['Christopher', 'Martin']}
I want to replace each value in df['text'] to have the corresponding key from the dictionary. I am confused on how to solve this!
My df should finally look like this:
| text | 
|---|
| 1023 | 
| 2213 | 
| 1023 | 
| 3346 | 
| 2213 | 
| 3346 | 
 
    