@dispatch(Join, Sequence, Sequence)
def compute_up(t, lhs, rhs, **kwargs):
 if (lhs == rhs):
  (lhs, rhs) = itertools.tee(lhs, 2)
 on_left = [t.lhs.fields.index(col) for col in listpack(t.on_left)]
 on_right = [t.rhs.fields.index(col) for col in listpack(t.on_right)]
 left_default = (None if (t.how in ('right', 'outer')) else toolz.itertoolz.no_default)
 right_default = (None if (t.how in ('left', 'outer')) else toolz.itertoolz.no_default)
 pairs = toolz.join(on_left, lhs, on_right, rhs, left_default=left_default, right_default=right_default)
 assemble = pair_assemble(t, on_left, on_right)
 return map(assemble, pairs)

@ dispatch ( Join , Sequence , Sequence ) def compute_up ( t , lhs , rhs , ** kwargs ) : if ( lhs == rhs ) : ( lhs , rhs ) = itertools . tee ( lhs , 2 ) on_left = [ t . lhs . fields . index ( col ) for col in listpack ( t . on_left ) ] on_right = [ t . rhs . fields . index ( col ) for col in listpack ( t . on_right ) ] left_default = ( None if ( t . how in ( 'right' , 'outer' ) ) else toolz . itertoolz . no_default ) right_default = ( None if ( t . how in ( 'left' , 'outer' ) ) else toolz . itertoolz . no_default ) pairs = toolz . join ( on_left , lhs , on_right , rhs , left_default = left_default , right_default = right_default ) assemble = pair_assemble ( t , on_left , on_right ) return map ( assemble , pairs )
join two pandas data frames on arbitrary columns the approach taken here could probably be improved .