Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Pythonを使用して1次元配列のコレクション内の1次元配列を比較しようとしています。例えば:
import numpy as np; data= np.array( [ [1,2] , [2,3] ,[3,4], [1,2] , [0,9] ]) #I want to get the indexes of [1,2] which are 0 and 3 for above list
誰かがPythonでそれを実装する方法を知っていますか?
In [116]: data = np.array( [ [1,2] , [1,3] ,[3,4], [1,2] , [0,9] ]) In [117]: np.where(np.prod(data == [1,2], axis = -1)) Out[117]: (array([0, 3]),)