atoti.measure module¶
-
class
atoti.measure.
Measure
¶ A measure is a mostly-numeric data value, computed on demand for aggregation purposes.
Measures can be compared to other objects, such as a literal value, a
Level
, or another measure. The returned measure represents the outcome of the comparison and this measure can be used as a condition. If the measure’s value isNone
when evaluating a condition, the returned value will beFalse
.Example
>>> df = pd.DataFrame( ... columns=["Id", "Value", "Threshold"], ... data=[ ... (0, 1.0, 5.0), ... (1, 2.0, None), ... (2, 3.0, 3.0), ... (3, 4.0, None), ... (4, 5.0, 1.0), ... ], ... ) >>> store = session.read_pandas(df, keys=["Id"], store_name="Measure example") >>> cube = session.create_cube(store) >>> l, m = cube.levels, cube.measures >>> m["Condition"] = m["Value.SUM"] > m["Threshold.SUM"] >>> cube.query(m["Condition"], levels=l["Id"]) Condition Id 0 False 1 False 2 False 3 False 4 True
-
class
atoti.measure.
MeasureConvertible
¶ Instances of this class can be converted to measures.