larray.AxisCollection

class larray.AxisCollection(axes=None)[source]

Represents a collection of axes.

Parameters:

axes : sequence of Axis or int or tuple or str, optional

An axis can be given as an Axis object, an int or a tuple (labels, name) or a string of the kind ‘name=label_1,label_2,label_3’.

Raises:

ValueError

Cannot have multiple occurrences of the same axis object in a collection.

Notes

Multiple occurrences of the same axis object is not allowed. However, several axes with the same name are allowed but this is not recommended.

Examples

>>> age = Axis(range(10), 'age')
>>> AxisCollection([3, age, (['M', 'F'], 'sex'), 'time = 2007, 2008, 2009, 2010'])
AxisCollection([
    Axis(3, None),
    Axis([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'age'),
    Axis(['M', 'F'], 'sex'),
    Axis([2007, 2008, 2009, 2010], 'time')
])
>>> AxisCollection('age=0..9; sex=M,F; time=2007..2010')
AxisCollection([
    Axis([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'age'),
    Axis(['M', 'F'], 'sex'),
    Axis([2007, 2008, 2009, 2010], 'time')
])
__init__(axes=None)[source]

Methods

__init__([axes])
align(other[, join, axes]) Align this axis collection with another.
append(axis) Appends axis at the end of the collection.
axis_id(axis) Returns the id of an axis.
check_compatible(axes) Checks if axes passed as argument are compatible with those contained in the collection.
combine_axes([axes, sep, wildcard, …]) Combine several axes into one.
copy() Returns a copy.
extend(axes[, validate, replace_wildcards]) Extends the collection by appending the axes from axes.
get(key[, default, name]) Returns axis corresponding to key.
get_all(key) Returns all axes from key if present and length 1 wildcard axes otherwise.
get_by_pos(key, i) Returns axis corresponding to a key, or to position i if the key has no name and key object not found.
index(axis) Returns the index of axis.
insert(index, axis) Inserts axis before index.
isaxis(value) Tests if input is an Axis object or the name of an axis contained in self.
keys() Returns list of all axis names.
pop([axis]) Removes and returns an axis.
replace([axes_to_replace, new_axis, inplace]) Replace one, several or all axes of the collection.
split_axes([axes, sep, names, regex]) Split axes and returns a new collection
split_axis(*args, **kwargs)
translate_full_key(key) Translates a label-based key to a positional key.
union(*args, **kwargs)
without(axes) Returns a new collection without some axes.