IndoBot-AI / validate_csv.py
Sofa321's picture
Create validate_csv.py
aaf33dc verified
raw
history blame
406 Bytes
import csv
# File Input dan Output
input_file = "dataset.csv"
output_file = "cleaned_dataset.csv"
# Bersihkan Dataset
with open(input_file, "r") as infile, open(output_file, "w", newline="") as outfile:
reader = csv.reader(infile)
writer = csv.writer(outfile)
for row in reader:
# Hanya tulis baris dengan tepat 2 kolom
if len(row) == 2:
writer.writerow(row)