craftutils.wrap.dragons.Table.update(other, copy=True)

Perform a dictionary-style update and merge metadata.

The argument other must be a |Table|, or something that can be used to initialize a table. Columns from (possibly converted) other are added to this table. In case of matching column names the column from this table is replaced with the one from other.

Parameters

othertable-like

Data to update this table with.

copybool

Whether the updated columns should be copies of or references to the originals.

See Also

add_columns, astropy.table.hstack, replace_column

Examples

Update a table with another table:

>>> t1 = Table({'a': ['foo', 'bar'], 'b': [0., 0.]}, meta={'i': 0})
>>> t2 = Table({'b': [1., 2.], 'c': [7., 11.]}, meta={'n': 2})
>>> t1.update(t2)
>>> t1
<Table length=2>
 a      b       c
str3 float64 float64
---- ------- -------
 foo     1.0     7.0
 bar     2.0    11.0
>>> t1.meta
{'i': 0, 'n': 2}

Update a table with a dictionary:

>>> t = Table({'a': ['foo', 'bar'], 'b': [0., 0.]})
>>> t.update({'b': [1., 2.]})
>>> t
<Table length=2>
 a      b
str3 float64
---- -------
 foo     1.0
 bar     2.0