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)¶
- Bases: - Sequence- A generic container for immutable data that can be accessed either by numeric index or by key. This is similar to an - collections.OrderedDictexcept that the keys are optional and iteration over it returns the values instead of keys.- This is the base class for both - Columnand- Row.- Parameters:
- values – A sequence of values. 
- keys – A sequence of keys. 
 
 - keys()¶
- Equivalent to - collections.OrderedDict.keys().
 - values()¶
- Equivalent to - collections.OrderedDict.values().
 - items()¶
- Equivalent to - collections.OrderedDict.items().
 - get(key, default=None)¶
- Equivalent to - collections.OrderedDict.get().
 - dict()¶
- Retrieve the contents of this sequence as an - collections.OrderedDict.
 
- class agate.Column(index, name, data_type, rows, row_names=None)¶
- Bases: - MappedSequence- Proxy access to column data. Instances of - Columnshould not be constructed directly. They are created by- Tableinstances 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 - MappedSequencethat contains the- Rowinstances containing the data for this column.
- row_names – An optional list of row names (keys) for this column. 
 
 - property index¶
- This column’s index. 
 - property name¶
- This column’s name. 
 - property data_type¶
- This column’s data type. 
 - values()¶
- Get the values in this column, as a tuple. 
 - values_distinct()¶
- Get the distinct values in this column, as a tuple. 
 - values_without_nulls()¶
- Get the values in this column with any null values removed. 
 - values_sorted()¶
- Get the values in this column sorted. 
 - values_without_nulls_sorted()¶
- Get the values in this column with any null values removed and sorted. 
 
- class agate.Row(values, keys=None)¶
- Bases: - MappedSequence- 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 - Tableinstances.- Currently row instances are a no-op subclass of - MappedSequence. They are being maintained in this fashion in order to support future features.