Last active
December 14, 2015 15:08
-
-
Save maddievision/5105391 to your computer and use it in GitHub Desktop.
join with outer join support
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
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