Spaces:
Sleeping
Sleeping
File size: 492 Bytes
b4bc889 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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}")
|