Revision 4504
Added by Aaron Marcuse-Kubitza about 12 years ago
intersect | ||
---|---|---|
1 | 1 |
#!/usr/bin/env python |
2 | 2 |
# Intersects two map spreadsheets A0->B and A1->C to A->B, with B overwriting C |
3 | 3 |
# Multi-safe (supports an input appearing multiple times). |
4 |
# Case- and punctuation-insensitive. |
|
4 | 5 |
|
5 | 6 |
import csv |
6 | 7 |
import os.path |
... | ... | |
21 | 22 |
if compare_col_nums == []: |
22 | 23 |
compare_col_nums = None # list_subset() value for all columns |
23 | 24 |
|
24 |
def compare_on(row): return tuple(util.list_subset(row, compare_col_nums)) |
|
25 |
def compare_on(row): return tuple(map(maps.simplify, |
|
26 |
util.list_subset(row, compare_col_nums))) |
|
25 | 27 |
|
26 | 28 |
headers = [None]*2 |
27 | 29 |
|
Also available in: Unified diff
intersect, union: Made case- and punctuation-insensitive. mappings/Veg+-VegBIEN.csv: Removed no longer needed duplicate entries for each first letter case, which must now be removed for case- and punctuation-insensitive intersect/union to work. Note that the SpeciesLink `svn diff` hides _alt entry 0, which contains one of the removed duplicate columns that appears in the diff.