The data structure is like this:
id | name | data |
---|---|---|
001 | aaa | true,false,false |
002 | bbb | true,true,true |
003 | ccc | false,true,true |
I want to map the results in data to their names by their corresponding orders in the mapping table. In detail, the first step is to get the order number of False in data and then get the name by order number in the mapping table.
For example, the first record has two False and their index numbers are 2 and 3, so the mapping result is code2 and code3. Also, there are all true in the second record so the mapping result is an empty string.
the mapping table: ("code1","code2","code3")
the expected result:
id | name | data |
---|---|---|
001 | aaa | code2,code3 |
002 | bbb | |
003 | ccc | code1 |
Is it possible to achieve this in the dataframe?