다음은 문제를 설명하기위한 작은 코드입니다.numpy 배열의 값 배열 위치
A = array([[1,2], [1,0], [5,3]])
f_of_A = f(A) # this is precomputed and expensive
values = array([[1,2], [1,0]])
# location of values in A
# if I just had 1d values I could use numpy.in1d here
indices = array([0, 1])
# example of operation type I need (recalculating f_of_A as needed is not an option)
f_of_A[ indices ]
그래서 기본적으로 더 높은 차원의 경우에는 in1d와 동등한 항목이 필요하다고 생각합니다. 그런 것이 있습니까? 아니면 다른 접근법이 있습니까?
searchsorted() 함수가있는 것처럼 보이지만 1d 배열에서도 작동하는 것으로 보입니다. 이 예에서는 2 차원 점을 사용했지만 모든 솔루션은 3 차원 점에서도 사용해야합니다.
가 어떻게'axis'의 작품을 설명 할 수 있습니까? 나는'np.all'에 대해 읽었고'axis'가 의미하는 것을 이해하지 못했습니다 –