Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created March 31, 2009 00:06
Show Gist options
  • Save mattpodwysocki/87967 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/87967 to your computer and use it in GitHub Desktop.
# 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