I have the following translation dictionary:
{0: {'a', 'b', 'c'},
1: {'a', 'b', 'c', 'd'},
2: {'k', 'b', 'e', 'a', 'n'}}
And I want to 'reverse' it to be attributes to keys (keys here are a form of id). Given a set of attributes, give me the relevant id (key).
For example, given {'a', 'b', 'c'}
return 0
.
What is the best practice to do this? The attributes can come in different order that's why I am using sets. Should I insert it into a dataframe (translation table)? Or there is another solution?