larray.LSet

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

Label set.

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

Parameters
keykey

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

namestr, optional

Name of the set.

axisint, 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, template])

Split group into several groups of specified length.

containing(substring)

Return a group with all the labels containing the specified substring.

difference(other)

Return (set) difference of this label group and other.

endingwith(suffix)

Return a group with the labels ending with the specified string.

equals(other)

Check if this group is equal to another group.

eval()

Translate key to labels, if it is not already, expanding slices in the process.

intersection(other)

Return (set) intersection of this label group and other.

matching([deprecated, pattern, regex])

Return a group with all the labels matching the specified pattern or regular expression.

named(name)

Return group with a different name.

retarget_to(target_axis)

Retarget group to another axis.

set()

Create LSet from this group.

startingwith(prefix)

Return a group with the labels starting with the specified string.

to_hdf(filepath[, key, axis_key])

Write group to a HDF file.

to_label()

Translate key to labels, if it is not already.

translate([bound, stop])

compute position(s) of group.

union(other)

Return (set) union of this label group and other.

with_axis(axis)

Return group with a different axis.

Attributes

axis

format_string

key

name