Skip to content

Instantly share code, notes, and snippets.

@tkheyfets tkheyfets/group_by.py
Last active Mar 16, 2018

Embed
What would you like to do?
def function_name (collection, k):
result = {}
for x in collection:
prop = x[k]
if prop not in result:
result[prop] = []
result[prop].append(x)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.