예제 #1
0
def test_get_or_construct_data_CN1():  # copied on the one in cn_test
    df = get_comptes_nationaux_data(2013)
    values_CN1_target = read_CN1(2013)
    variables_CN1 = generate_CN1_variables(2013)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1,
                                                     range(1949, 2014))
    assert_frame_equal(values_CN1, values_CN1_target)
예제 #2
0
def test_compare_sheets_to_IPP():  # WIP. for now it only generates the first two sheets, to be compared to Agrégats IPP
    df = get_tidy_data(2012)
    variables_CN1 = generate_CN1_variables(2012)
    variables_CN2 = generate_CN2_variables(2012)
    values_CN1_2012, formulas_CN1 = get_or_construct_data(df, variables_CN1, range(1949, 2013))
    values_CN2_2012, formulas_CN2 = get_or_construct_data(df, variables_CN2, range(1949, 2013))
    return values_CN1_2012, values_CN2_2012
예제 #3
0
def test_CN1(year):
    df = get_tidy_data(year)
    values_CN1_target = read_CN1(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1, range(1949, year + 1))

    assert_frame_equal(values_CN1, values_CN1_target)
예제 #4
0
def create_and_save_CN1(year):  # NB : should no longer be executed - already saved
    file_path = (os.path.join(tests_data, 'values_CN1_{}.h5'.format(year)))
    assert not os.path.exists(file_path), 'CN1 sheet with {} data already generated and saved'.format(year)
    df = get_tidy_data(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1, range(1949, year + 1))
    values_CN1.to_hdf(file_path, 'CN1')
예제 #5
0
def test_CN1(year):
    df = get_tidy_data(year)
    values_CN1_target = read_CN1(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1,
                                                     range(1949, year + 1))

    assert_frame_equal(values_CN1, values_CN1_target)
def test_get_or_construct_data_CN1():  # copied on the one in cn_test
    df = get_comptes_nationaux_data(2013)
    values_CN1_target = read_CN1(2013)
    variables_CN1 = generate_CN1_variables(2013)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1, range(1949, 2014))
    print values_CN1.columns
    print values_CN1_target.columns
    assert_frame_equal(values_CN1, values_CN1_target)
예제 #7
0
def test_compare_sheets_to_IPP(
):  # WIP. for now it only generates the first two sheets, to be compared to Agrégats IPP
    df = get_tidy_data(2012)
    variables_CN1 = generate_CN1_variables(2012)
    variables_CN2 = generate_CN2_variables(2012)
    values_CN1_2012, formulas_CN1 = get_or_construct_data(
        df, variables_CN1, range(1949, 2013))
    values_CN2_2012, formulas_CN2 = get_or_construct_data(
        df, variables_CN2, range(1949, 2013))
    return values_CN1_2012, values_CN2_2012
예제 #8
0
def create_and_save_CN1(
        year):  # NB : should no longer be executed - already saved
    file_path = (os.path.join(tests_data, 'values_CN1_{}.h5'.format(year)))
    assert not os.path.exists(
        file_path
    ), 'CN1 sheet with {} data already generated and saved'.format(year)
    df = get_tidy_data(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1,
                                                     range(1949, year + 1))
    values_CN1.to_hdf(file_path, 'CN1')
예제 #9
0
def generate_CN1(year):
    df = get_tidy_data(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1,
                                                     range(1949, year + 1))
    return values_CN1, formulas_CN1
def generate_CN1(year):
    df = get_tidy_data(year)
    variables_CN1 = generate_CN1_variables(year)
    values_CN1, formulas_CN1 = get_or_construct_data(df, variables_CN1, range(1949, year + 1))
    return values_CN1, formulas_CN1