Пример #1
0
def test_group_runs(root, schema, encoding, **unused):
    with tempdir(cleanup_on_error=CLEANUP_ON_ERROR):
        with loom.preql.get_server(root, encoding, debug=True) as preql:
            test_columns = json_load(schema).keys()[:10]
            for column in test_columns:
                groupings_csv = 'group.{}.csv'.format(column)
                preql.group(column, result_out=groupings_csv)
                print open(groupings_csv).read()
Пример #2
0
def test_group_runs(root, schema, encoding, **unused):
    with tempdir(cleanup_on_error=CLEANUP_ON_ERROR):
        with loom.preql.get_server(root, encoding, debug=True) as preql:
            test_columns = json_load(schema).keys()[:10]
            for column in test_columns:
                groupings_csv = 'group.{}.csv'.format(column)
                preql.group(column, result_out=groupings_csv)
                print open(groupings_csv).read()
Пример #3
0
def test_group_pandas(root, rows_csv, rows, **unused):
    row_count = sum(1 for _ in protobuf_stream_load(rows))
    with loom.preql.get_server(root, debug=True) as preql:
        feature_names = preql.feature_names
        for feature in feature_names[:10]:
            result_string = preql.group(feature)
            result_df = pandas.read_csv(StringIO(result_string), index_col=0)
            print 'result_df ='
            print result_df
            assert_equal(result_df.ndim, 2)
            assert_equal(result_df.shape[0], row_count)
            assert_equal(result_df.shape[1], 2)
Пример #4
0
def test_group_pandas(root, rows_csv, rows, **unused):
    row_count = sum(1 for _ in protobuf_stream_load(rows))
    with loom.preql.get_server(root, debug=True) as preql:
        feature_names = preql.feature_names
        for feature in feature_names[:10]:
            result_string = preql.group(feature)
            result_df = pandas.read_csv(StringIO(result_string), index_col=0)
            print 'result_df ='
            print result_df
            assert_equal(result_df.ndim, 2)
            assert_equal(result_df.shape[0], row_count)
            assert_equal(result_df.shape[1], 2)