>>> import numpy as np
>>> a=np.arange(0,2,0.2)
>>> a
array([ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8])
>>> a=a.tolist()
>>> a
[0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0, 1.2000000000000002, 1.4000000000000001, 1.6, 1.8]
>>> a.index(0.6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 0.6 is not in list
it appears that some values in the list have changed and I can't find them with index()
. How can I fix that?