Created
October 11, 2019 00:10
-
-
Save GeorgeSeif/86261f089dace958999f73536da732cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def membership_map(pandas_series, groups_dict): | |
groups = {x: k for k, v in groups_dict.items() for x in v} | |
mapped_series = pandas_series.map(groups) | |
return mapped_series | |
mapped_data = membership_map(foods, groups_dict) | |
print(list(mapped_data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment