Dimension objects¶
-
class
cr.cube.dimension.
Dimension
¶ Represents one dimension of a cube response.
Each dimension represents one of the variables in a cube response. For example, a query to cross-tabulate snack-food preference against region will have two variables (snack-food preference and region) and will produce a two-dimensional (2D) cube response. That cube will have two of these dimension objects, which are accessed using
CrunchCube.dimensions
.-
alias
¶ Return the alias for the dimension if it exists, None otherwise.
-
all_elements
¶ _AllElements object providing cats or subvars of this dimension.
Elements in this sequence appear in cube-result order. Display order (including resolution of the explicit-reordering transforms cascade) is provided by a separate .display_order attribute on _AllElements.
-
apply_transforms
(dimension_transforms)¶ Return a new Dimension object with dimension_transforms applied.
The new dimension object is the same as this one in all other respects.
-
description
¶ str description of this dimension.
-
dimension_type
¶ Member of DIMENSION_TYPE appropriate to this cube dimension.
-
element_ids
¶ tuple of int element-id for each valid element in this dimension.
Element-ids appear in the order defined in the cube-result.
tuple of int element-idx for each hidden valid element in this dimension.
An element is hidden when a “hide” transform is applied to it in its transforms dict.
-
insertion_ids
¶ tuple of int insertion-id for each insertion in this dimension.
Insertion-ids appear in the order insertions are defined in the dimension.
-
name
¶ str name of this dimension, the empty string (“”) if not specified.
-
numeric_values
¶ tuple of numeric values for valid elements of this dimension.
Each category of a categorical variable can be assigned a numeric value. For example, one might assign like=1, dislike=-1, neutral=0. These numeric mappings allow quantitative operations (such as mean) to be applied to what now forms a scale (in this example, a scale of preference).
The numeric values appear in the same order as the categories/elements of this dimension. Each element is represented by a value, but an element with no numeric value appears as np.nan in the returned list.
-
order_spec
¶ _OrderSpec proxy object for dimension.transforms.order dict from payload.
-
prune
¶ True if empty elements should be automatically hidden on this dimension.
-
selected_categories
¶ List of selected categories specified for this dimension.
-
shape
¶ int count of all elements in this dimension, both valid and missing.
-
subtotals
¶ _Subtotals sequence object for this dimension.
Each item in the sequence is a _Subtotal object specifying a subtotal, including its addends and anchor.
-
valid_elements
¶ _Elements object providing access to non-missing elements.
Any categories or subvariables representing missing data are excluded from the collection; this sequence represents a subset of that provided by .all_elements.
-