[Numpy-discussion] interesect1d bug?

Tom Denniston tom.denniston@alum.dartmouth....
Thu Sep 20 15:23:25 CDT 2007


Is this the expected behavior of the numpy.intersect1d funciton:

In [8]: numpy.intersect1d([3766, 9583, 17220, 40048, 50909, 52241,
62494, 828525, 20548728, 14874, 320256, 12795, 2223137, 16554, 27901,
2031774, 13610, 1592688, 13585, 16205, 1181652, 37177, 828525, 52241,
113826, 285236, 19475, 933518, 3114301, 38132], [35971, 28972, 4126,
212327])
Out[8]: array([ 52241, 828525])

Note that neither 52241 nor 828525 are in the second arg.

It doesn't even work if I sort them:

In [9]: numpy.intersect1d(sorted([3766, 9583, 17220, 40048, 50909,
52241, 62494, 828525, 20548728, 14874, 320256, 12795, 2223137, 16554,
27901, 2031774, 13610, 1592688, 13585, 16205, 1181652, 37177, 828525,
52241, 113826, 285236, 19475, 933518, 3114301, 38132]), sorted([35971,
28972, 4126, 212327]))
Out[9]: array([ 52241, 828525])



--Tom


More information about the Numpy-discussion mailing list