I make an array:
X = np.arange(0.001, 1, 0.001)
Later I want to find the points in X that match a value I pull and format from a dataframe x1:
index1 = np.where(X == x1)
I've looked at this post, but:
np.arangeproduces anarrayx1is anarray
I'm left very confused.
I tried it on a scratch pad in PyCharm:
import numpy as np
precision = 3
delta = 10 ** -precision
a = np.arange(delta, 1, delta)
n = np.array([0.070])
print(np.where(a == n))
If n equals 0.071, 0.072, 0.073, it returns an empty cell. Many values of n give me a value and very few produce an error from an empty array.
I want to find all the values I need.
Thanks.