Bases: astropy.table.Column, numpy.ma.core.MaskedArray
Define a masked data column for use in a Table object.
Parameters: | data : list, ndarray or None
name : str
mask : list, ndarray or None
fill_value : float, int, str or None
dtype : numpy.dtype compatible value
shape : tuple or ()
length : int or 0
description : str or None
unit : str or None
format : str or None or function or callable
meta : dict-like or None
|
---|
Examples
A MaskedColumn is similar to a Column except that it includes mask and fill_value attributes. It can be created in two different ways:
Provide a data value but not shape or length (which are inferred from the data).
Examples:
col = MaskedColumn(data=[1, 2], name='name')
col = MaskedColumn(data=[1, 2], name='name', mask=[True, False])
col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99)
The mask argument will be cast as a boolean array and specifies which elements are considered to be missing or invalid.
The dtype argument can be any value which is an acceptable fixed-size data-type initializer for the numpy.dtype() method. See http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html. Examples include:
If no dtype value is provide then the type is inferred using np.array(data). When data is provided then the shape and length arguments are ignored.
Provide length and optionally shape, but not data
Examples:
col = MaskedColumn(name='name', length=5)
col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4))
The default dtype is np.float64. The shape argument is the array shape of a single cell in the column.
Attributes Summary
data | |
fill_value | |
name |
Methods Summary
convert_unit_to(new_unit[, equivalencies]) | Converts the values of the column in-place from the current unit to the given unit. |
copy([order, data, copy_data]) | Return a copy of the current instance. |
filled([fill_value]) | Return a copy of self, with masked values filled with a given value. |
more([max_lines, show_name, show_unit]) | Interactively browse column with a paging interface. |
pformat([max_lines, show_name, show_unit]) | Return a list of formatted string representation of column values. |
pprint([max_lines, show_name, show_unit]) | Print a formatted string representation of column values. |
Attributes Documentation
Methods Documentation
Converts the values of the column in-place from the current unit to the given unit.
To change the unit associated with this column without actually changing the data values, simply set the unit property.
Parameters: | new_unit : str or astropy.units.UnitBase instance
equivalencies : list of equivalence pairs, optional
|
---|---|
Raises: | astropy.units.UnitsError
|
Return a copy of the current instance.
If data is supplied then a view (reference) of data is used, and copy_data is ignored.
Parameters: | order : {‘C’, ‘F’, ‘A’, ‘K’}, optional
data : array, optional
copy_data : bool, optional
|
---|---|
Returns: | col: Column or MaskedColumn
|
Return a copy of self, with masked values filled with a given value.
Parameters: | fill_value : scalar; optional |
---|---|
Returns: | filled_column : Column
|
Interactively browse column with a paging interface.
Supported keys:
f, <space> : forward one page
b : back one page
r : refresh same page
n : next row
p : previous row
< : go to beginning
> : go to end
q : quit browsing
h : print this help
Parameters: | max_lines : int
show_name : bool
show_unit : bool
|
---|
Return a list of formatted string representation of column values.
If no value of max_lines is supplied then the height of the screen terminal is used to set max_lines. If the terminal height cannot be determined then the default will be determined using the astropy.conf.max_lines configuration item. If a negative value of max_lines is supplied then there is no line limit applied.
Parameters: | max_lines : int
show_name : bool
show_unit : bool
|
---|---|
Returns: | lines : list
|
Print a formatted string representation of column values.
If no value of max_lines is supplied then the height of the screen terminal is used to set max_lines. If the terminal height cannot be determined then the default will be determined using the astropy.conf.max_lines configuration item. If a negative value of max_lines is supplied then there is no line limit applied.
Parameters: | max_lines : int
show_name : bool
show_unit : bool
|
---|