>>> df = pd.DataFrame(
... columns=["Continent", "City", "Price"],
... data=[
... ("Europe", "Paris", 200.0),
... ("Europe", "Berlin", 150.0),
... ("Europe", "London", 240.0),
... ("North America", "New York", 270.0),
... ],
... )
>>> table = session.read_pandas(
... df,
... table_name="City price table",
... )
>>> table.head()
Continent City Price
0 Europe Paris 200.0
1 Europe Berlin 150.0
2 Europe London 240.0
3 North America New York 270.0
>>> cube = session.create_cube(table, mode="manual")
>>> h, l, m = cube.hierarchies, cube.levels, cube.measures
>>> h["Geography"] = [table["Continent"], table["City"]]
>>> m["Price"] = tt.agg.single_value(table["Price"])
>>> m["City with maximum price"] = tt.agg.max_member(m["Price"], l["City"])