larray.LGroup

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

Label group.

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

axis : int, 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__(self, key, name=None, axis=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, key[, name, axis]) Initialize self.
by(self, length[, step, template]) Split group into several groups of specified length.
containing(self, substring) Returns a group with all the labels containing the specified substring.
difference(self, other) Returns (set) difference of this label group and other.
endingwith(self, suffix) Returns a group with the labels ending with the specified string.
equals(self, other) Checks if this group is equal to another group.
eval(self) Translate key to labels, if it is not already, expanding slices in the process.
intersection(self, other) Returns (set) intersection of this label group and other.
matching(self[, deprecated, pattern, regex]) Returns a group with all the labels matching the specified pattern or regular expression.
named(self, name) Returns group with a different name.
retarget_to(self, target_axis) Retarget group to another axis.
set(self) Creates LSet from this group
startingwith(self, prefix) Returns a group with the labels starting with the specified string.
to_hdf(self, filepath[, key, axis_key]) Writes group to a HDF file.
to_label(self) Translate key to labels, if it is not already
translate(self[, bound, stop]) compute position(s) of group
union(self, other) Returns (set) union of this label group and other.
with_axis(self, axis) Returns group with a different axis.

Attributes

axis
format_string
key
name