'Comparing arrays for equality with condition on one entry
Let's say I have a "Truth" array:
a = [1,2,3]
and I want to compare it to b for equality with
b = [1,2,3]
awkward.all(a == b)
Easy enough. Now we want this to be a general code which works for all of our data. But for one of these cases, have a truth of let's say:
c =[x>0, 2, 3]
so the first entry can be anything. Now we could of course say ak.all(a[1:] == c[1:]) but then we cannot use this requirement on the first case anymore. So is there a way to keep the general behavior of comparing two arrays with each other but one array entry can be anything bigger than zero?
I also know we can go the long way and compare every entry by itself, but we would like to avoid that if possible.
I would be happy for any suggestions
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
