Skip to content
masterclass Buddy

NumPy · Function

np.intersect1d

Find the sorted, unique values shared by two arrays. You can also return the first matching index in each input.

Last updated

Syntax

numpy.intersect1d(ar1, ar2, assume_unique=False, return_indices=False)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • numpy.ma.intersect1d
  • functools.reduce

Source: numpy.intersect1d — NumPy v2.5 Manual. Checked 2026-11-03.