Skip to content

Instantly share code, notes, and snippets.

@tim37021
Created April 5, 2019 16:01
Show Gist options
  • Save tim37021/b560af267606853417b366212e526f3d to your computer and use it in GitHub Desktop.
Save tim37021/b560af267606853417b366212e526f3d to your computer and use it in GitHub Desktop.
Numpy subscribe
# arr = [1, 2, 3, 4, 5]
arr = np.arange(5)
# [1, 2, 3]
arr[[0, 1, 2]]
# [1, 3, 5]
arr[[True, False, True, False, True]]
# [4, 5]
arr[arr>3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment