-
craftutils.wrap.dragons.Table.replace_column(name, col, copy=
True) Replace column
namewith the newcolobject.The behavior of
copyfor Column objects is: - copy=True: new class instance with a copy of data and deep copy of meta - copy=False: new class instance with same data and a key-only copy of metaFor mixin columns: - copy=True: new class instance with copy of data and deep copy of meta - copy=False: original instance (no copy at all)
Parameters¶
- namestr
Name of column to replace
- col~astropy.table.Column or ~numpy.ndarray or sequence
New column object to replace the existing column.
- copybool
Make copy of the input
col, default=True
See Also¶
add_columns, astropy.table.hstack, update
Examples¶
Replace column ‘a’ with a float version of itself:
>>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b')) >>> float_a = t['a'].astype(float) >>> t.replace_column('a', float_a)