atoti.hierarchies module¶
- class atoti.hierarchies.Hierarchies(_java_api, _cube)¶
Manage the hierarchies.
A hierarchy can be renamed by creating a new one with the same levels and then removing the old one.
Example
>>> prices_df = pd.DataFrame( ... columns=["Nation", "City", "Price"], ... data=[ ... ("France", "Paris", 20.0), ... ("France", "Lyon", 15.0), ... ("France", "Toulouse", 10.0), ... ("UK", "London", 20.0), ... ("UK", "Manchester", 15.0), ... ], ... ) >>> table = session.read_pandas(prices_df, table_name="Prices") >>> cube = session.create_cube(table) >>> h = cube.hierarchies >>> h["Country"] = h["Nation"].levels >>> del h["Nation"]