BaseColumnInfo#
- class astropy.utils.data_info.BaseColumnInfo(bound=False)[source]#
Bases:
DataInfo
Base info class for anything that can be a column in an astropy Table.
There are at least two classes that inherit from this:
ColumnInfo: for native astropy Column / MaskedColumn objects MixinInfo: for mixin column objects
Note that this class is defined here so that mixins can use it without importing the table package.
Attributes Summary
Methods Summary
adjust_indices
(index, value, col_len)Adjust info indices after column modification.
Return a list of arrays which can be lexically sorted to represent the order of the parent column.
This is a mixin-safe version of Column.iter_str_vals.
merge_cols_attributes
(cols, ...)Utility method to merge and validate the attributes
attrs
for the input table columnscols
.slice_indices
(col_slice, item, col_len)Given a sliced object, modify its indices to correctly represent the slice.
Attributes Documentation
- attr_names = {'description', 'dtype', 'format', 'indices', 'meta', 'name', 'parent_table', 'unit'}#
- indices#
- parent_table#
Methods Documentation
- adjust_indices(index, value, col_len)[source]#
Adjust info indices after column modification.
- Parameters:
- index
slice
,python:int
,python:list
, orndarray
Element(s) of column to modify. This parameter can be a single row number, a list of row numbers, an ndarray of row numbers, a boolean ndarray (a mask), or a column slice.
- value
python:int
,python:list
, orndarray
New value(s) to insert
- col_len
python:int
Length of the column
- index
- get_sortable_arrays()[source]#
Return a list of arrays which can be lexically sorted to represent the order of the parent column.
The base method raises NotImplementedError and must be overridden.
- Returns:
- arrays
python:list
ofndarray
- arrays
- static merge_cols_attributes(cols, metadata_conflicts, name, attrs)[source]#
Utility method to merge and validate the attributes
attrs
for the input table columnscols
.Note that
dtype
andshape
attributes are handled specially. These should not be passed inattrs
but will always be in the returned dict of merged attributes.- Parameters:
- cols
python:list
List of input Table column objects
- metadata_conflicts
python:str
(‘warn’|’error’|’silent’) How to handle metadata conflicts
- name
python:str
Output column name
- attrs
python:list
List of attribute names to be merged
- cols
- Returns:
- attrs
python:dict
Of merged attributes.
- attrs
- slice_indices(col_slice, item, col_len)[source]#
Given a sliced object, modify its indices to correctly represent the slice.
- Parameters:
- col_slice
Column
or mixin Sliced object. If not a column, it must be a valid mixin, see https://docs.astropy.org/en/stable/table/mixin_columns.html
- item
slice
,python:list
, orndarray
Slice used to create col_slice
- col_len
python:int
Length of original object
- col_slice