Slice objects

class cr.cube.cubepart.CubePartition(cube, transforms=None)

A slice, a strand, or a nub drawn from a cube-response.

These represent 2, 1, or 0 dimensions of a cube, respectively.

cube_index

Offset of this partition’s cube in its CubeSet.

Used to differentiate certain partitions like a filtered rows-summary strand.

dimension_types

Sequence of member of cr.cube.enum.DIMENSION_TYPE for each dimension.

Items appear in rows-dimension, columns-dimension order.

evaluate(measure_expr)

Return 1D/2D ndarray result of evaluating measure_expr.

measure_expr contains the function to apply and its parameters, like:

{
     "function": "one_sided_moving_avg",
     "base_measure": "col_percent",
     "window": 3
}

This expression specifies application of the one_sided_moving_avg function to the col_percent base-measure, with a sliding window of 3 periods.

classmethod factory(cube, slice_idx=0, transforms=None, population=None, ca_as_0th=None, mask_size=0)

Return slice, strand, or nub object appropriate to passed parameters.

ndim

int count of dimensions for this partition.

population_fraction

population fraction of the cube

selected_category_labels

Tuple of str: names of any and all underlying categories in ‘Selected’.

shape

Tuple of int vector counts for this partition.

Not to be confused with numpy.ndarray.shape, this represent the count of rows and columns respectively, in this partition. It does not necessarily represent the shape of any underlying numpy.ndarray object that may arise in the implementation of the cube partition. In particular, the value of any count in the shape can be zero.

A _Slice has a shape like (2, 3) representing (row-count, col-count). A _Strand has a shape like (5,) which represents its row-count. The shape of a _Nub is unconditionally () (an empty tuple).

variable_name

str representing the name of the superheading variable.