@deprecated(u'1.0', message=DEPRECATION_MESSAGE)
def join(left, right, keys=None, join_type=u'inner', uniq_col_name=u'{col_name}_{table_name}', table_names=[u'1', u'2'], col_name_map=None):
 _col_name_map = col_name_map
 if (join_type not in (u'inner', u'outer', u'left', u'right')):
  raise ValueError(u"The 'join_type' argument should be in 'inner', 'outer', 'left' or 'right' (got '{0}' instead)".format(join_type))
 if (keys is None):
  keys = tuple((name for name in left.dtype.names if (name in right.dtype.names)))
  if (len(keys) == 0):
   raise TableMergeError(u'No keys in common between left and right tables')
 elif isinstance(keys, six.string_types):
  keys = (keys,)
 for (arr, arr_label) in ((left, u'Left'), (right, u'Right')):
  for name in keys:
   if (name not in arr.dtype.names):
    raise TableMergeError(u'{0} table does not have key column {1!r}'.format(arr_label, name))
   if (hasattr(arr[name], u'mask') and np.any(arr[name].mask)):
    raise TableMergeError(u'{0} key column {1!r} has missing values'.format(arr_label, name))
 left = left.ravel()
 right = right.ravel()
 (len_left, len_right) = (len(left), len(right))
 (left_names, right_names) = (left.dtype.names, right.dtype.names)
 col_name_map = get_col_name_map([left, right], keys, uniq_col_name, table_names)
 out_descrs = get_descrs([left, right], col_name_map)
 out_keys_dtype = [descr for descr in out_descrs if (descr[0] in keys)]
 out_keys = np.empty((len_left + len_right), dtype=out_keys_dtype)
 for key in keys:
  out_keys[key][:len_left] = left[key]
  out_keys[key][len_left:] = right[key]
 idx_sort = out_keys.argsort(order=keys)
 out_keys = out_keys[idx_sort]
 diffs = np.concatenate(([True], (out_keys[1:] != out_keys[:(-1)]), [True]))
 idxs = np.flatnonzero(diffs)
 int_join_type = {u'inner': 0, u'outer': 1, u'left': 2, u'right': 3}[join_type]
 (masked, n_out, left_out, left_mask, right_out, right_mask) = _np_utils.join_inner(idxs, idx_sort, len_left, int_join_type)
 if any((isinstance(array, ma.MaskedArray) for array in (left, right))):
  masked = True
 if masked:
  out = ma.empty(n_out, dtype=out_descrs)
 else:
  out = np.empty(n_out, dtype=out_descrs)
 if (len(left) == 0):
  left = left.__class__(1, dtype=left.dtype)
 if (len(right) == 0):
  right = right.__class__(1, dtype=right.dtype)
 for (out_name, left_right_names) in six.iteritems(col_name_map):
  (left_name, right_name) = left_right_names
  if (left_name and right_name):
   out[out_name] = np.where(right_mask, left[left_name].take(left_out), right[right_name].take(right_out))
   continue
  elif left_name:
   (name, array, array_out, array_mask) = (left_name, left, left_out, left_mask)
  elif right_name:
   (name, array, array_out, array_mask) = (right_name, right, right_out, right_mask)
  else:
   raise TableMergeError(u'Unexpected column names (maybe one is ""?)')
  out[out_name] = array[name].take(array_out, axis=0)
  if masked:
   if isinstance(array, ma.MaskedArray):
    array_mask = (array_mask | array[name].mask.take(array_out))
   out[out_name].mask = array_mask
 if isinstance(_col_name_map, collections.Mapping):
  _col_name_map.update(col_name_map)
 return out

@ deprecated ( u'1.0' , message = DEPRECATION_MESSAGE ) def join ( left , right , keys = None , join_type = u'inner' , uniq_col_name = u'{col_name}_{table_name}' , table_names = [ u'1' , u'2' ] , col_name_map = None ) : _col_name_map = col_name_map if ( join_type not in ( u'inner' , u'outer' , u'left' , u'right' ) ) : raise ValueError ( u"The 'join_type' argument should be in 'inner', 'outer', 'left' or 'right' (got '{0}' instead)" . format ( join_type ) ) if ( keys is None ) : keys = tuple ( ( name for name in left . dtype . names if ( name in right . dtype . names ) ) ) if ( len ( keys ) == 0 ) : raise TableMergeError ( u'No keys in common between left and right tables' ) elif isinstance ( keys , six . string_types ) : keys = ( keys , ) for ( arr , arr_label ) in ( ( left , u'Left' ) , ( right , u'Right' ) ) : for name in keys : if ( name not in arr . dtype . names ) : raise TableMergeError ( u'{0} table does not have key column {1!r}' . format ( arr_label , name ) ) if ( hasattr ( arr [ name ] , u'mask' ) and np . any ( arr [ name ] . mask ) ) : raise TableMergeError ( u'{0} key column {1!r} has missing values' . format ( arr_label , name ) ) left = left . ravel ( ) right = right . ravel ( ) ( len_left , len_right ) = ( len ( left ) , len ( right ) ) ( left_names , right_names ) = ( left . dtype . names , right . dtype . names ) col_name_map = get_col_name_map ( [ left , right ] , keys , uniq_col_name , table_names ) out_descrs = get_descrs ( [ left , right ] , col_name_map ) out_keys_dtype = [ descr for descr in out_descrs if ( descr [ 0 ] in keys ) ] out_keys = np . empty ( ( len_left + len_right ) , dtype = out_keys_dtype ) for key in keys : out_keys [ key ] [ : len_left ] = left [ key ] out_keys [ key ] [ len_left : ] = right [ key ] idx_sort = out_keys . argsort ( order = keys ) out_keys = out_keys [ idx_sort ] diffs = np . concatenate ( ( [ True ] , ( out_keys [ 1 : ] != out_keys [ : ( - 1 ) ] ) , [ True ] ) ) idxs = np . flatnonzero ( diffs ) int_join_type = { u'inner' : 0 , u'outer' : 1 , u'left' : 2 , u'right' : 3 } [ join_type ] ( masked , n_out , left_out , left_mask , right_out , right_mask ) = _np_utils . join_inner ( idxs , idx_sort , len_left , int_join_type ) if any ( ( isinstance ( array , ma . MaskedArray ) for array in ( left , right ) ) ) : masked = True if masked : out = ma . empty ( n_out , dtype = out_descrs ) else : out = np . empty ( n_out , dtype = out_descrs ) if ( len ( left ) == 0 ) : left = left . __class__ ( 1 , dtype = left . dtype ) if ( len ( right ) == 0 ) : right = right . __class__ ( 1 , dtype = right . dtype ) for ( out_name , left_right_names ) in six . iteritems ( col_name_map ) : ( left_name , right_name ) = left_right_names if ( left_name and right_name ) : out [ out_name ] = np . where ( right_mask , left [ left_name ] . take ( left_out ) , right [ right_name ] . take ( right_out ) ) continue elif left_name : ( name , array , array_out , array_mask ) = ( left_name , left , left_out , left_mask ) elif right_name : ( name , array , array_out , array_mask ) = ( right_name , right , right_out , right_mask ) else : raise TableMergeError ( u'Unexpected column names (maybe one is ""?)' ) out [ out_name ] = array [ name ] . take ( array_out , axis = 0 ) if masked : if isinstance ( array , ma . MaskedArray ) : array_mask = ( array_mask | array [ name ] . mask . take ( array_out ) ) out [ out_name ] . mask = array_mask if isinstance ( _col_name_map , collections . Mapping ) : _col_name_map . update ( col_name_map ) return out
joins a list with a string .