Created
July 31, 2020 03:43
-
-
Save SungYK/4a23c94c9eb6b275d3d2bd90a0b2a5dd to your computer and use it in GitHub Desktop.
This file contains 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
>>> arr = np.array([0,1,2,3,4,5,6,7,8,9]) | |
>>> arr | |
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) | |
>>> mask = np.array([1,3,5,7]) | |
>>> arr[mask] | |
array([1, 3, 5, 7]) | |
>>> do some operation | |
array([0, 1, 0, 3, 0, 5, 0, 7, 0, 0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment