vstack#

astropy.table.vstack(tables, join_type='outer', metadata_conflicts='warn')[source]#

Stack tables vertically (along rows).

A join_type of ‘exact’ means that the tables must all have exactly the same column names (though the order can vary). If join_type is ‘inner’ then the intersection of common columns will be the output. A value of ‘outer’ (default) means the output will have the union of all columns, with table values being masked where no common values are available.

Parameters:
tablesTable or Row or list thereof

Table(s) to stack along rows (vertically) with the current table

join_typestr

Join type (‘inner’ | ‘exact’ | ‘outer’), default is ‘outer’

metadata_conflictsstr
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.

Returns:
stacked_tableTable object

New table containing the stacked data from the input tables.

Examples

To stack two tables along rows do:

>>> from astropy.table import vstack, Table
>>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))
>>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))
>>> print(t1)
 a   b
--- ---
  1   3
  2   4
>>> print(t2)
 a   b
--- ---
  5   7
  6   8
>>> print(vstack([t1, t2]))
 a   b
--- ---
  1   3
  2   4
  5   7
  6   8