Offene FoodFacts - Problem zur Lösung von Parsen aufgrund von Speicherfehler [geschlossen]
Posted: 12 Apr 2025, 16:58
Ich versuche, Datenbank von OpenFoodFacts zu verwenden, aber ich begegne Parser -Fehler. Als ich versuchte, es zu lösen, begegne ich das Problem mit dem Gedächtnis. />https://fleuryc.github.io/oc_ingenieur- ... e/notebook />"https://world.openfoodfacts.org/data/en ... oducts.csv"
Aufgenommen, mein Versuch
Mein Gehirn ist flüssig, danke für die Hilfe
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'))