Skip to content
Advertisement

Map the multiple value dictionary with a dataframe column

I have a dictionary with multiple values for 1 key. Now, I need to map them with the dataframe column. Any idea how can I solve this?

Dictionary

JavaScript

Data

JavaScript

Expected

JavaScript

Advertisement

Answer

First we convert the Keys_nd_Values to a df and convert the rows to columns. The function we wrote later does this: get the value of the column if the row value exists as a column in the df named control.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement