I wrote some codes, but want to make it faster.
import numpy as np
test_unit = np.array([[1,2,3,4]])
if set(np.unique(test_unit).astype(int)) >= set((1,2,3)):
print('True')
What I want to do is writing the if-statement that if elements of matrix have (1 AND 2 AND 3, at least), then do a job. The test_unit in my real code is 2*2*2 matrix in about 400*400*200 matrix. If you guys don't mind, could you please give me some tips for this statement problem?
Aucun commentaire:
Enregistrer un commentaire