larray.LSet

class larray.LSet(key, name=None, axis=None)[source]

Label set.

Represents a set of (unique) labels of an axis.

Parameters:

key : key

Anything usable for indexing. A key should be either sequence of labels, a slice with label bounds or a string.

name : str, optional

Name of the set.

axis : int, str, Axis, optional

Axis for set.

Examples

>>> from larray import Axis
>>> letters = Axis('letters=a..z')
>>> abc = letters[':c'].set() >> 'abc'
>>> abc
letters['a', 'b', 'c'].set() >> 'abc'
>>> abc & letters['b:d']
letters['b', 'c'].set()
__init__(key, name=None, axis=None)[source]

Methods

__init__(key[, name, axis])
by(length[, step]) Split group into several groups of specified length.
containing(substring) Returns a group with all the labels containing the specified substring.
difference(other)
endingwith(suffix) Returns a group with the labels ending with the specified string.
eval()
intersection(other)
matching(pattern) Returns a group with all the labels matching the specified pattern (regular expression).
named(name) Returns group with a different name.
retarget_to(target_axis) Retarget group to another axis.
set() Creates LSet from this group
startingwith(prefix) Returns a group with the labels starting with the specified string.
to_label()
translate([bound, stop]) compute position(s) of group
union(other)
with_axis(axis) Returns group with a different axis.