Commit a0f0d3f7 authored by Elias's avatar Elias

keep only lines where Val is at least 2 and Test is at least 2

parent 6680fc6c
import csv
input_file = "res5_Random.csv"
output_file = "res6_Random.csv"
with open(input_file, mode="r", newline="") as f_in, open(output_file, mode="w", newline="") as f_out:
reader = csv.reader(f_in)
writer = csv.writer(f_out)
header = next(reader)
writer.writerow(header) # écrire l'en-tête
for row in reader:
mot, train, val, test = row
if int(train) >= 2 and int(val) >= 2 and int(test) >= 2:
writer.writerow(row)
print(f"Fichier filtré sauvegardé dans '{output_file}'")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment