csv merger

This commit is contained in:
Tom Selier 2023-10-14 16:22:15 +02:00
parent 2654872e87
commit ecb48e602b

View File

@ -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')