def test_to_pandas(events): ht = HierarchyTree.from_geo_events(df=events, lat_col='start_latitude', lon_col='start_longitude', nodes=('city', 'hex_index_6', 'hex_index_7', 'hex_index_8'), levels=(6, 8), resample_freq='1H', min_count=0.5) assert isinstance(ht.to_pandas(), pandas.DataFrame)
def test_to_pandas(events): ht = HierarchyTree.from_geo_events( df=events, lat_col="start_latitude", lon_col="start_longitude", nodes=("city", "hex_index_6", "hex_index_7", "hex_index_8"), levels=(6, 8), resample_freq="1H", min_count=0.5, ) assert isinstance(ht.to_pandas(), pandas.DataFrame)
def test_create_from_events(events): ht = HierarchyTree.from_geo_events(df=events, lat_col='start_latitude', lon_col='start_longitude', nodes=('city', 'hex_index_6', 'hex_index_7', 'hex_index_8'), levels=(6, 8), resample_freq='1H', min_count=0.5) assert isinstance(ht, NAryTreeT) assert len(ht.children) == events['city'].nunique()
def test_create_from_events(events): ht = HierarchyTree.from_geo_events( df=events, lat_col="start_latitude", lon_col="start_longitude", nodes=("city", "hex_index_6", "hex_index_7", "hex_index_8"), levels=(6, 8), resample_freq="1H", min_count=0.5, ) assert isinstance(ht, NAryTreeT) assert len(ht.children) == events["city"].nunique()