I have a list of lists, such that:
a = [[1,0.8,0.4,0.1,0.3,0.5,1],
[1,0.8,0.5,0.0,0.3,0.5,1]],
........................]
As can be seen in a[1]
there is a negative value in the array. At some point later on in my code, I subtract the lowest value away from a constant (in this case it is 1) within a loop, such that:
b = []
for i in range(len(a)):
b.append(1-min(a[i]))
However this presents a problem as in a[1]
I want 1-0.1 and not 1-0.0. The value of 0.0 was originally a negative value (its a noisy data point) and so I used:
a[a<0]=0.0
I cannot remove the value entirely using a=a[a>0.0]
as it is important that I keep all of the data points (these are y values that have corresponding x values). I would ideally like to ignore it rather then remove it.
Is there a way I could achieve something like:
b = []
for i in range(len(a)):
b.append(1-min(a[i]) where min(a[i]) is greater than 0) # i.e. the lowest value that isn't 0