Skip to content
masterclass Buddy

NumPy · Function

np.setdiff1d

np.setdiff1d returns the unique values in one array that are missing from another. By default, it returns the result in sorted order.

Last updated

Syntax

numpy.setdiff1d(ar1, ar2, assume_unique=False)

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

Subscribe
  • numpy.ma.setdiff1d
  • numpy.intersect1d
  • numpy.union1d

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