agate.columns

This module contains the Column class, which defines a “vertical” array of tabular data. Whereas Row instances are independent of their parent Table, columns depend on knowledge of both their position in the parent (column name, data type) as well as the rows that contain their data.

agate.columns.null_handler(k)

Key method for sorting nulls correctly.

class agate.columns.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 by Table 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 the Row instances containing the data for this column.
  • row_names – An optional list of row names (keys) for this column.
index

This column’s index.

name

This column’s name.

data_type

This column’s data type.

values_without_nulls()

Get the data contained in this column with any null values removed.

values_sorted()

Get the data contained in this column sorted.

values_without_nulls_sorted()

Get the data contained in this column with any null values removed and sorted.

aggregate(aggregation)

Apply a Aggregation to this column and return the result. If the aggregation defines a cache_key the result will be cached for future requests.