Skip to main content
`Ctrl`+`K`

# join

astropy.table.join(left, right, keys=None, join_type='inner', *, keys_left=None, keys_right=None, keep_order=False, uniq_col_name='{col_name}_{table_name}', table_names=['1', '2'], metadata_conflicts='warn', join_funcs=None)

  Perform a join of the left table with the right table on specified keys.

  Parameters:
    left `Table` astropy:-like `object`

      Left side table in the join. If not a Table, will call `Table(left)`

    right `Table` astropy:-like `object`

      Right side table in the join. If not a Table, will call `Table(right)`

    keys `python:str` or `python:list` of `python:str`

      Name(s) of column(s) used to match rows of left and right tables. Default is to use all columns which are common to both tables.

    join_type `python:str`

      Join type (‘inner’ | ‘outer’ | ‘left’ | ‘right’ | ‘cartesian’), default is ‘inner’

    keys_left `python:str` or `python:list` of `python:str` or `python:list` of column-like, optional

      Left column(s) used to match rows instead of `keys` arg. This can be be a single left table column name or list of column names, or a list of column-like values with the same lengths as the left table.

    keys_right `python:str` or `python:list` of `python:str` or `python:list` of column-like, optional

      Same as `keys_left`, but for the right side of the join.

    keep_order: bool, optional

      By default, rows are sorted by the join keys. If True, preserve the order of rows from the left table for “inner” or “left” joins, or from the right table for “right” joins. For other join types this argument is ignored except that a warning is issued if `keep_order=True`.

    uniq_col_name `python:str` or `python:None`

      String generate a unique output column name in case of a conflict. The default is ‘{col_name}_{table_name}’.

    table_names `python:list` of `python:str` or `python:None`

      Two-element list of table names used when generating unique output column names. The default is [‘1’, ‘2’].

    metadata_conflicts `python:str`
      How to proceed with metadata conflicts. This should be one of:

        - `'silent'`: silently pick the last conflicting meta-data value

        - `'warn'`: pick the last conflicting meta-data value, but emit a warning (default)

        - `'error'`: raise an exception.

    join_funcs `python:dict`, `python:None`

      Dict of functions to use for matching the corresponding key column(s). See `join_skycoord` for an example and details.

  Returns:
    joined_table `Table` `object`

      New table containing the result of the join operation.