Columns and rows¶
A generic container for immutable data that can be accessed either by numeric index or by key. |
|
Proxy access to column data. |
|
A row of data. |
- class agate.MappedSequence(values, keys=None)¶
A generic container for immutable data that can be accessed either by numeric index or by key. This is similar to an
collections.OrderedDict
except that the keys are optional and iteration over it returns the values instead of keys.This is the base class for both
Column
andRow
.- Parameters:
values – A sequence of values.
keys – A sequence of keys.
- class agate.Column(index, name, data_type, rows, row_names=None)¶
Proxy access to column data. Instances of
Column
should not be constructed directly. They are created byTable
instances and are unique to them.Columns are implemented as subclass of
MappedSequence
. They deviate from the underlying implementation in that loading of their data is deferred until it is needed.- Parameters:
name – The name of this column.
data_type – An instance of
DataType
.rows – A
MappedSequence
that contains theRow
instances containing the data for this column.row_names – An optional list of row names (keys) for this column.
- class agate.Row(values, keys=None)¶
A row of data. Values within a row can be accessed by column name or column index. Row are immutable and may be shared between
Table
instances.Currently row instances are a no-op subclass of
MappedSequence
. They are being maintained in this fashion in order to support future features.