IndoBot-AI / clean_csv.py
Sofa321's picture
Create clean_csv.py
b4bc889 verified
raw
history blame
492 Bytes
import csv
# Nama 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)
# Periksa setiap baris
for row in reader:
# Hanya simpan baris dengan 2 kolom
if len(row) == 2:
writer.writerow(row)
print(f"Dataset telah dibersihkan. Simpan ke: {output_file}")