atoti_query.QueryLevel.isnull()#

QueryLevel.isnull()#

Return a condition evaluating to True when a level is not expressed in a query and False otherwise.

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

Example

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

Condition[LevelIdentifier, Literal[‘eq’], None, None]