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.

keys()

The row names for this column, if any.

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.