[Numpy-discussion] extract elements of an array that are contained in another array?
Alan G Isaac
Thu Jun 4 10:12:17 CDT 2009
> On Thu, Jun 4, 2009 at 10:13 AM, Alan G Isaac <email@example.com> wrote:
>> Or if a stable order is not important (I don't
>> recall if the OP specified), one could just
>> np.intersect1d(a, np.unique(b))
On 6/4/2009 10:50 AM firstname.lastname@example.org apparently wrote:
> This requires that also `a` has only unique elements.
> intersect1d_nu doesn't require unique elements.
array([1, 1, 2, 3, 3, 4])
>>> np.intersect1d(a, np.unique(b))
array([1, 1, 3, 4])
(And thus my question about intersect1d...)
More information about the Numpy-discussion