interesect1d bug?

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

On Thu, 20 Sep 2007, Tom Denniston apparently wrote:
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])
There are duplicates in your first array. (See the docs.) hth, Alan Isaac
participants (2)
-
Alan G Isaac
-
Tom Denniston