If I correctly understand the objective (which in doubt) in 'pure' Python it could be done this way:
>>> a = [[1,2,3],[42,68,69],[1,2,3],[85,89,95]] >>> b= [[42,68,69],[1,2,3],[85,89,95], [42,68,69]] >>> len([(x, y) for x in a for y in b if x == y]) 5To 'translate' this into numpy array it needs little adjustments:
>>> import numpy as np >>> a = np.matrix([[1,2,3],[42,68,69],[1,2,3],[85,89,95]]) >>> b = np.matrix([[42,68,69],[1,2,3],[85,89,95], [42,68,69]]) >>> len([(x, y) for x in a for y in b if np.array_equal(x, y)]) 5
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.