larray.LGroup

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

Label group.

Represents a subset of 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 group.

axisint, str, Axis, optional

Axis for group.

Examples

>>> from larray import Axis, X
>>> age = Axis('0..100', 'age')
>>> teens = X.age[10:19].named('teens')
>>> teens
X.age[10:19] >> 'teens'
>>> teens = X.age[10:19] >> 'teens'
>>> teens
X.age[10:19] >> 'teens'
__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