コード例 #1
0
def test_get_releases_by_amount_of_bidders():

    releases = get_releases(parse_json(TEST_JSON))

    pprint.pprint(get_releases_by_amount_of_bidders(releases).keys())

    assert set(get_releases_by_amount_of_bidders(releases).keys()) == set([0,1,2,3,4])
コード例 #2
0
ファイル: histogram.py プロジェクト: jorenretel/use-case-demo
from indicatorCalculation.indicator.indicator import get_releases_by_amount_of_bidders

output_file("histogram.html", title="Number of bidders frequency")


def create_histogram(releases):

    number_of_bidders_list = []
    frequency_list = []
    for number_of_bidders, corresponding_releases in get_releases_by_amount_of_bidders(releases).items():
        number_of_bidders_list.append(number_of_bidders)
        frequency_list.append(len(corresponding_releases))

    zeros = [0]*len(frequency_list)
    right = [x+1 for x in number_of_bidders_list]
    histogram = quad(top=frequency_list, bottom=zeros, left=number_of_bidders_list, right=right)

    histogram.title = "Frequency of releases vs. Number of Bidders"
    xaxis()[0].axis_label = "Number of Bidders"
    yaxis()[0].axis_label = "Frequency of Releases"

    show()




if __name__ == '__main__':
    from indicatorCalculation.json_parser.parser import parse_json, get_releases
    releases = get_releases(parse_json('tests/test_data/georgia_small.json'))

    create_histogram(releases)
コード例 #3
0
def releases():
    return get_releases(parse_json(TEST_JSON))
コード例 #4
0
def parsed_json():
    return parse_json(TEST_JSON)