def transpose_data_service(X, c, arff=False, *args, **kwargs):
    start_time = datetime.now()
    X_absolute = BUILDOUT_DIR + '/var/www' + X
    Y = '%s_transposed%s' % splitext(X)
    Y_absolute = BUILDOUT_DIR + '/var/www' + Y
    if X.endswith('arff'):
        arff = True
    transpose(X_absolute, Y_absolute, int(c), arff=arff)
    duration = datetime.now() - start_time
    return [('Y', Y), ('calcTime', duration)]
Exemple #2
0
def transpose_data_service(X, c, arff=False, *args, **kwargs):
    start_time = datetime.now()
    X_absolute = BUILDOUT_DIR + '/var/www' + X
    Y = '%s_transposed%s' % splitext(X)
    Y_absolute = BUILDOUT_DIR + '/var/www' + Y
    if X.endswith('arff'):
        arff = True
    transpose(X_absolute, Y_absolute, int(c), arff=arff)
    duration = datetime.now() - start_time
    return [('Y', Y), ('calcTime', duration)]
Exemple #3
0
    def test_transpose(self):
        source = join(TEST_FILE_PATH, u'klasės.csv')
        output = join(TEST_FILE_PATH, 'tmp', u'trokštami_išėjimai.csv')
        attr_to_transpose = -1
        transpose(source, output=output, attr=attr_to_transpose)
        self.assertTrue(exists(output))

        with open(output) as output_file:
            for line_nr, attr_list in enumerate(csv.reader(output_file)):
                self.assertTrue('1' in attr_list[-3:][line_nr % 3])
                self.assertTrue('0' in attr_list[-3:][(line_nr + 1) % 3])
                self.assertTrue('0' in attr_list[-3:][(line_nr + 2) % 3])
Exemple #4
0
    def test_transpose(self):
        source = join(TEST_FILE_PATH, u'klasės.csv')
        output = join(TEST_FILE_PATH, 'tmp', u'trokštami_išėjimai.csv')
        attr_to_transpose = -1
        transpose(source, output=output, attr=attr_to_transpose)
        self.assertTrue(exists(output))

        with open(output) as output_file:
            for line_nr, attr_list in enumerate(csv.reader(output_file)):
                self.assertTrue('1' in attr_list[-3:][line_nr % 3])
                self.assertTrue('0' in attr_list[-3:][(line_nr + 1) % 3])
                self.assertTrue('0' in attr_list[-3:][(line_nr + 2) % 3])