Last active
January 5, 2018 23:48
-
-
Save photizzo/3090beab4cf1ecdfd133b28c5f85f012 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
array = [[True, False], [True, True]] # (2,2) array of boolean values | |
array_cond_true = [[1, 2], [3, 4]] # (2,2) array of where to pick values if array at position is true | |
array_cond_false = [[9, 8], [7, 6]] # (2,2) array of where to pick values if array at position is false | |
print ("result: \n" + str(np.where(array, | |
array_cond_true, | |
array_cond_false))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment