Created
March 31, 2009 00:06
-
-
Save mattpodwysocki/87967 to your computer and use it in GitHub Desktop.
This file contains 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
# prefs = Map String (Map String Double) | |
def transformPrefs(prefs): | |
result={} | |
for person in prefs: | |
for item in prefs[person]: | |
result.setdefault(item,{}) | |
# Flip item and person | |
result[item][person]=prefs[person][item] | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment