bundles / astropy latest / astropy / io / fits / hdu / table / _TableLikeHDU / from_columns
classmethod
astropy.io.fits.hdu.table:_TableLikeHDU.from_columns
source: /astropy/io/fits/hdu/table.py :86
Summary
Given either a ColDefs object, a sequence of Column objects, or another table HDU or table data (a FITS_rec or multi-field numpy.ndarray or numpy.recarray object, return a new table HDU of the class this method was called on using the column definition from the input.
Extended Summary
See also FITS_rec.from_columns.
Parameters
columns: sequence of `Column`, `ColDefs` -likeThe columns from which to create the table data, or an object with a column-like structure from which a ColDefs can be instantiated. This includes an existing BinTableHDU or TableHDU, or a numpy.recarray to give some examples.
If these columns have data arrays attached that data may be used in initializing the new table. Otherwise the input columns will be used as a template for a new table with the requested number of rows.
header: `Header`An optional Header object to instantiate the new HDU yet. Header keywords specifically related to defining the table structure (such as the "TXXXn" keywords like TTYPEn) will be overridden by the supplied column definitions, but all other informational and data model-specific keywords are kept.
nrows: intNumber of rows in the new table. If the input columns have data associated with them, the size of the largest input column is used. Otherwise the default is 0.
fill: boolIf
True, will fill all cells with zeros or blanks. IfFalse, copy the data from input, undefined cells will still be filled with zeros/blanks.character_as_bytes: boolWhether to return bytes for string columns when accessed from the HDU. By default this is
Falseand (unicode) strings are returned, but for large tables this may use up a lot of memory.
Notes
Any additional keyword arguments accepted by the HDU class's __init__ may also be passed in as keyword arguments.
Aliases
-
astropy.io.fits.diff._TableLikeHDU.from_columns