About 67,600 results
Open links in new tab
  1. numpy.where — NumPy v2.4 Manual

    When only condition is provided, this function is a shorthand for np.asarray(condition).nonzero(). Using nonzero directly should be preferred, as it behaves correctly for subclasses.

  2. numpy.where () in Python - GeeksforGeeks

    Sep 30, 2025 · np.where (...) with a single argument returns a tuple containing the indices of True entries. The returned value (array ( [3, 4]),) indicates elements at positions 3 and 4 satisfy the condition.

  3. How does python numpy.where() work? - Stack Overflow

    Honestly, it's fairly rare that you actually need numpy.where but it just returns the indicies where a boolean array is True. Usually you can do what you need with simple boolean indexing. Sign up to …

  4. How to Use Conditional Expressions With NumPy where () - Real Python

    You would typically use np.where() when you have an array and need to analyze its elements differently depending on their values. For example, you might need to replace negative numbers with zeros or …

  5. An Ultimate Guide to Python numpy.where() method - AskPython

    Jan 21, 2026 · That’s Python np where in action. You give it a condition, tell it what to return when True, what to return when False, and it runs that logic across your entire array without loops.

  6. NumPy Where: Conditional Array Operations Made Simple

    Feb 10, 2026 · Learn how to use numpy.where() for conditional element selection, filtering, and replacing values in arrays. Complete guide with practical examples.

  7. NumPy where () - Programiz

    To learn about it, visit np.where () with a single argument section below. The where() method returns a new NumPy array. Output. We can also use numpy.where() to perform operations on array …

  8. Python's `np.where` Function: A Comprehensive Guide

    Apr 25, 2025 · The np.where function in Python's numpy library is a versatile and powerful tool for conditional operations on arrays. It simplifies data cleaning, preprocessing, and feature …

  9. Exploring NumPy where () in Python for Conditional Operations

    Sep 17, 2025 · np.where() is a function in NumPy that returns elements based on a specified parameter, which is similar to asking, “Where does this happen?" The fundamental syntax of NumPy

  10. NumPy where () Function With Examples - Spark By Examples

    Mar 27, 2024 · In this article, I will explain Python NumPy where() function using its syntax, parameters, and how to use it to check the conditions on an array and get an array based on …