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.

N
numpy.org
official

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.

D
datacamp.com
tool

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.

Y
youtube.com
video

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.

G
github.com
tool

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.

N
numpy.org
official

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.