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

    Return elements chosen from x or y depending on condition. When only condition is provided, this function is a shorthand for np.asarray(condition).nonzero(). Using nonzero directly should be …

  2. pandas.DataFrame.where — pandas 3.0.2 documentation

    Roughly df1.where(m, df2) is equivalent to np.where(m, df1, df2). For further details and examples see the where documentation in indexing. The dtype of the object takes precedence. The fill value is …

  3. numpy.where() in Python - GeeksforGeeks

    Sep 30, 2025 · In this example, np.where () is used with only a condition to get the indices where elements are greater than 20. Explanation: arr > 20 produces a boolean mask: [False, False, False, …

  4. Np.where In Pandas Python

    May 8, 2025 · One of the most efficient tools in the Python data science ecosystem is np.where(), especially when used with Pandas. In this comprehensive guide, I’ll walk you through everything you …

  5. 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.

  6. 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 …

  7. NumPy where () - DataCamp

    Learn how to effectively use the 'numpy where' function for conditional data manipulation in arrays. This guide offers step-by-step instructions and practical examples for efficient data processing.

  8. NumPy where() Function With Examples - Spark By {Examples}

    Mar 27, 2024 · The numpy.where() function in Python’s NumPy library is used to create a new array from an existing array based on specified conditions. It returns the indices of the elements in the …

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

    Jan 21, 2026 · You can use numpy.where () with just the condition argument, dropping the x and y values entirely. This returns the indices where your condition evaluates to True. This version gets …

  10. Python's `where` Function: A Comprehensive Guide - CodeRivers

    Mar 28, 2025 · In Python, the concept of "where" is not a built-in keyword like in some other programming languages. However, there are several ways to achieve the functionality similar to what …