def test_elements_count_group_by_key():
    '\n    Tests counting elements within a bounding box and grouping them by keys\n    :return:\n    '
    bboxes = '8.67066,49.41423,8.68177,49.4204'
    time = '2010-01-01/2011-01-01/P1Y'
    groupByKeys = ['building']
    timestamps = ['2010-01-01T00:00:00Z', '2011-01-01T00:00:00Z', '2010-01-01T00:00:00Z', '2011-01-01T00:00:00Z']
    counts = [482.0, 628.0, 53.0, 256.0]
    keys = ['remainder', 'remainder', 'building', 'building']
    expected = pd.DataFrame({'key': keys, 'timestamp': timestamps, 'value': counts})
    expected.set_index(['key', 'timestamp'], inplace=True)
    client = ohsome.OhsomeClient()
    response = client.elements.count.groupBy.key.post(bboxes=bboxes, groupByKeys=groupByKeys, time=time)
    results = response.as_dataframe()
    assert expected.equals(results)
Tests counting elements within a bounding box and grouping them by keys
:return:
def test_elements_count_group_by_key():
    '\n    Tests counting elements within a bounding box and grouping them by keys\n    :return:\n    '
    bboxes = '8.67066,49.41423,8.68177,49.4204'
    time = '2010-01-01/2011-01-01/P1Y'
    groupByKeys = ['building']
    timestamps = ['2010-01-01T00:00:00Z', '2011-01-01T00:00:00Z', '2010-01-01T00:00:00Z', '2011-01-01T00:00:00Z']
    counts = [482.0, 628.0, 53.0, 256.0]
    keys = ['remainder', 'remainder', 'building', 'building']
    expected = pd.DataFrame({'key': keys, 'timestamp': timestamps, 'value': counts})
    expected.set_index(['key', 'timestamp'], inplace=True)
    client = ohsome.OhsomeClient()
    response = client.elements.count.groupBy.key.post(bboxes=bboxes, groupByKeys=groupByKeys, time=time)
    results = response.as_dataframe()
    assert expected.equals(results)