8 results ·
AI-generated index
S
stackoverflow.com
article
NumPy: Replace values in a 2D array based on condition
You can use the np.where() function to replace values in a 2D array where a condition is true. This function takes three arguments: the condition, the value to replace with if the condition is true, and the value to replace with if the condition is false.
Replacing values in a 2D NumPy array
The numpy.where() function is a vectorized version of the Python if statement. It allows you to replace values in a 2D array based on a condition. You can also use boolean indexing to achieve this.
G
geeksforgeeks.org
article
How to replace values in a 2D array using NumPy
To replace values in a 2D array using NumPy, you can use the numpy.putmask() function or the numpy.where() function. Both functions allow you to specify a condition and replace values based on that condition.
NumPy Tutorial: Replacing values in a 2D array
In this tutorial, you will learn how to replace values in a 2D NumPy array using the numpy.where() function and boolean indexing. You will also learn how to use the numpy.putmask() function to replace values.
Replacing values in a 2D array with NumPy
This video tutorial shows you how to replace values in a 2D NumPy array using the numpy.where() function and boolean indexing. You will also learn how to use the numpy.putmask() function.
S
scipy-lectures.org
research
NumPy: Advanced indexing and replacing values
This lecture notes discuss advanced indexing and replacing values in NumPy arrays. You will learn how to use boolean indexing and the numpy.where() function to replace values in a 2D array.
Replace values in a 2D NumPy array based on condition
This GitHub repository provides an example of how to replace values in a 2D NumPy array based on a condition. The code uses the numpy.where() function to replace values.
NumPy documentation: numpy.where() function
The numpy.where() function is used to replace values in a 2D array based on a condition. This function is a vectorized version of the Python if statement.