Open teolemon opened 8 years ago
please update
done
Luxembourg claimed and done by @k3lyn
Portugal claimed & under progress
A small python code that I wrote to help me aggregate all csv file into one (useful when there are a lot of them ...) Feel free to use.
import csv
import os
### Lines with 3 ### might need adaptation to your need
MAIN_CSV = '/Users/Maxime/Downloads/Portugal/Portugal.csv' ### PATH of the csv where you will agregate everything
main_csv_file = open(MAIN_CSV, 'a', newline='',encoding = "UTF-8") # 'a' to append and not overwrite ; encoding might need adaptation to handle special characters
main_csv_writer = csv.writer(main_csv_file, delimiter=';',quotechar='|') ### DELIMITER to choose wisely
folder_path = "/Users/Maxime/Downloads/Portugal/sources" ### SET to your folder with all csv
for file in os.listdir(folder_path): #loop over all files
if not file.startswith('.'): #avoid any hidden file, useful on mac
print ('handling : '+file)
with open(folder_path+'/'+file, newline='',encoding = "ISO-8859-1") as csvfile: ###Adapt encoding to your country source encoding
csvreader = csv.reader(csvfile, delimiter=';',quotechar='|')
#print('csv reader is ok')
i=0
for row in csvreader:
#print ('row = ', i)
#print (row)
if i!=0: ### to avoid the first line with all column labels
main_csv_writer.writerow(row)
i+=1
print (str(i)+' rows have been loaded')
main_csv_file.close()
Portugal done. Sweden claimed and done.
Thanks for the code ! Slovakia claimed.
Ireland claimed.
Norway claimed. sections: 0,5, 6, 9, 10, 12, 13 done. I upload the corresponding csv.
Finland was done in #2620
List of all packaging codes in EU
Part of