From ecb48e602b9e9030dca143d7d5f1ec52441a7059 Mon Sep 17 00:00:00 2001 From: Tom Selier Date: Sat, 14 Oct 2023 16:22:15 +0200 Subject: [PATCH] csv merger --- src/experiments/csv_merger.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/experiments/csv_merger.py diff --git a/src/experiments/csv_merger.py b/src/experiments/csv_merger.py new file mode 100644 index 0000000..c8a8ce2 --- /dev/null +++ b/src/experiments/csv_merger.py @@ -0,0 +1,33 @@ +import csv + +SIFT_PATH = "src\\experiments\\algorithms\\data\\sift.csv" +SUITE_PATH = "dataset\\csv\\result-2023-10-14T16.13.30.csv" +OUTPUT_DIR = "dataset\\csv\\" + +data = [] +with open(SIFT_PATH) as file: + reader = csv.reader(file, delimiter=',') + lst = list(reader) + for row in lst: + data.append(row) + +new_data = [] +with open(SUITE_PATH) as file: + reader = csv.reader(file, delimiter=',') + lst = list(reader) + for row in lst: + new_data.append(row) + +data[0].extend(new_data[0][2:]) +for element in data[1:]: + for new_element in new_data[1:]: + if int(element[1]) == int(new_element[1]): + for idx in new_element[2:]: + element.append(idx) + print(element[1], new_element[1]) + +with open(OUTPUT_DIR + "combined.csv", 'w') as file: + for element in data: + for idx in element: + file.write(str(idx) + ',') + file.write('\n') \ No newline at end of file