How to use the numpy.where () function
This article will explain in detail how to use the numpy.where () function. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Recently used the numpy.where () function, most of the use of can understand, but looking at
> x = np.arange (9.) .reshape (3,3) > > np.where (x > 5) (array ([2,2,2]), array ([0,1,2]))
When I was confused, why two arrays?
Later, it was found that the return value was actually given to the coordinates. taking the above formula as an example, the return value is actually
X [2, 0], x [2, 1], x [2, 2]
That is, for the array x, the return value is two arrays an and b, where the position of the qualified value in x is
X [a [0], b [0]], x [a [1], b [1]],..., x [a [I], b [I]] on "how to use the numpy.where () function" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.