Revision 730
Added by Aaron Marcuse-Kubitza almost 13 years ago
join | ||
---|---|---|
16 | 16 |
reader = csv.reader(stream) |
17 | 17 |
map_1_in, map_1_out = reader.next()[:2] |
18 | 18 |
for row in reader: |
19 |
if row[1] != '': map_1[row[0]] = row[1]
|
|
19 |
if row[0] != '': map_1[row[0]] = row[1]
|
|
20 | 20 |
stream.close() |
21 | 21 |
|
22 | 22 |
# Join map 1 to map 0 |
... | ... | |
28 | 28 |
cols[1] = map_1_out |
29 | 29 |
writer.writerow(cols) |
30 | 30 |
for row in reader: |
31 |
row[1] = map_1.get(row[1], '') |
|
31 |
if row[1] != '': |
|
32 |
try: row[1] = map_1[row[1]] |
|
33 |
except KeyError: |
|
34 |
row[2] = '** No join mapping for '+row[1]+' ** '+row[2] |
|
35 |
row[1] = '' |
|
32 | 36 |
writer.writerow(row) |
33 | 37 |
|
34 | 38 |
main() |
Also available in: Unified diff
join: Report which input mappings are missing a mapping in the join map