Skip to content
masterclass Buddy

NumPy · Function

np.where

Select elements from x or y according to a Boolean condition. The inputs can be broadcast to a shared shape.

Last updated

Syntax

numpy.where(condition, [x, y, ] /)

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

Subscribe
  • choose
  • nonzero

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