agate.mapped_sequence

This module contains the MappedSequence class that forms the foundation for agate’s Row and Column as well as for named sequences of rows and columns.

class agate.mapped_sequence.MappedSequence(values, keys=None)

Bases: _abcoll.Sequence

A generic container for 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.

Parameters:
  • values – A sequence of Row instances.
  • keys – See Table.__init__().
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 column as an collections.OrderedDict.