atoti.measure_description module#

class atoti.MeasureConvertible#

Instances of this class can be converted to measures.

class atoti.MeasureDescription#

The description of a Measure that has not been added to the cube yet.

isnull()#

Return a measure evaluating to True if the measure is None and False otherwise.

Use ~measure.isnull() for the opposite behavior.

Example

>>> df = pd.DataFrame(
...     columns=["Country", "City", "Price"],
...     data=[
...         ("France", "Paris", 200.0),
...         ("Germany", "Berlin", None),
...     ],
... )
>>> table = session.read_pandas(df, table_name="isnull example")
>>> cube = session.create_cube(table)
>>> l, m = cube.levels, cube.measures
>>> m["Price.isnull"] = m["Price.SUM"].isnull()
>>> m["Price.notnull"] = ~m["Price.SUM"].isnull()
>>> cube.query(
...     m["Price.isnull"],
...     m["Price.notnull"],
...     levels=[l["Country"]],
... )
        Price.isnull Price.notnull
Country
France         False          True
Germany         True         False