Aufgenommen, mein Versuch
Code: Select all
import os.path
import pandas as pd
# define csv path
local_path = os.getcwd() + '\\'
csv_filename = 'fr.openfoodfacts.org.products.csv'
csv_path = local_path + csv_filename
# define the name of the file where I will record dataset corrected
corrected_file = 'OFF_corrected.csv'
corrected_file_path = local_path + corrected_file
# Apply correction and save it
with open(csv_path, 'r') as csv_file, open(corrected_file_path, 'a') as clean_file:
chunk_size=1000
for chunk in csv_file (chunksize=chunk_size):
clean_file.write(chunk.replace('\n\t', '\t'))