What is the easiest way to save elements from a list using np.where or similar?
A short example:
l1 = [-144.92170726320364, 697.7739312692029, -2.0, -2.0]
I want to keep the elements which are different from -2.0. I tried:
l2 = [l1[index] for index in len(l1) if l1[index] != -2.0]
As well as:
l3 = np.where(l1 != -2.0)
In first case I received error. In the second case I obtained (array([0]),).
Thanks for the help.