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'
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)Returns (set) difference of this label group and other. endingwith(suffix)Returns a group with the labels ending with the specified string. eval()intersection(other)Returns (set) intersection of this label group and 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)Returns (set) union of this label group and other. with_axis(axis)Returns group with a different axis.