You can put the records into a dictionary with ID and Date as keys. If the key does not exist in the dictionary, put it directly. If it already exists, add "PROJ_1 to RE_6" if they have values. ".
I’m not sure what you mean by “merging into one line”, but the general code can be similar to the following. If the merging method is wrong, you can modify it yourself:
import csv
result = {}
with open('/Volumes/MacDocuments/Downloads/testSheet.csv', 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
print(row)
print(len(row))
key = '{}-{}'.format(row[0], row[5])
if result.get(key, None):
result[key].extend(row[8:])
else:
result[key] = row
print(result)
Implemented one using Perl6
How to use
You can put the records into a dictionary with ID and Date as keys. If the key does not exist in the dictionary, put it directly. If it already exists, add "PROJ_1 to RE_6" if they have values. ".
I’m not sure what you mean by “merging into one line”, but the general code can be similar to the following. If the merging method is wrong, you can modify it yourself: