visidata
visidata copied to clipboard
Merge has surprising result
I'm creating toy examples for an Anki deck and find unexpected behavior for merge, which I thought might mean: "keep all rows from first sheet and matching rows from other sheets, updating the first sheet's data with the first non-False value." (The intro says, "Merges differences from other sheets into first sheet"; the quick reference says, "merge mostly keep all rows from first selected sheet, except prioritise cells with non-null/non-error values.")
ID Name Age
1 Alice 25
2 Bob 30
3 Carol
4 David 40
ID Name Age
2 35
3 30
5 Emily 28
After setting ID as the key column, when making the first sheet the uppermost (shift+k
) and merging (& merge
), I'd expect:
ID Name Age
1 Alice 25
2 Bob 35
3 Carol 30
4 David 40
But I get:
ID Name Age
1 Alice 25
2 Bob 30
3 Carol 30
4 David 40
5 Emily 28
I'm surprised Emily is included and that Bob's age is not 35.
The text files are in this zip. Using v2.11.