I have two arrays of type float (compare and hh3). I want to compare each element of "compare" to that of "hh3" and the result gets added to another vector pp.
I have searched for the error on this website and I know the reason for it being the "if a>b" comparison doesn't work if a and b are arrays
#hh3 is a array of length 70
#pp is an zero vector of a specified length
K = 0
compare = np.arange(1, 2, 1e-4)
compare_size = len(compare)
for j in range(compare_size):
for i in range(no*nos):
if hh3[i] >= compare[j]:
pp[K] = pp[K] + 1
if pp[K] == 0:
break
K = K + 1
In the end I want to compare each i element of hh3 to each j element of compare. The error occurs in "if hh3[i] >= compare[j]:"
Aucun commentaire:
Enregistrer un commentaire