Created
February 22, 2018 20:25
-
-
Save grizwako/239980ce4789ac6dbb0b7e4488003332 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
from collections import defaultdict | |
def group_products_by_locations(locations_by_product): | |
products_by_locations = defaultdict(list) | |
for product, locations in locations_by_product.items(): | |
for location in locations: | |
products_by_locations[location].append(product) | |
return products_by_locations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment