Skip to content

Instantly share code, notes, and snippets.

@maddievision
Last active December 14, 2015 15:08
Show Gist options
  • Save maddievision/5105391 to your computer and use it in GitHub Desktop.
Save maddievision/5105391 to your computer and use it in GitHub Desktop.
join with outer join support
def join(t,col,rt,rcol=None,outer=False):
if not rcol:
rcol = col
for entry in t:
matches = [d for d in rt if d[rcol] == entry[col]]
for match in matches:
yield entry,match
if len(matches) == 0 and outer:
yield entry,None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment