Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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()
Esempio n. 4
0
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()