Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get array with another array indexing with NumPy

arr_1 = np.array([5, 1, 6, 3, 3, 10, 3, 6, 12])
arr_2 = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90])
arr_idx_num_3 = np.where(arr_1 == 3)[0]
print(arr_idx_num_3)  ## [3 4 6]

#how to i get this array Numpy with "arr_idx_num_3"

arr_2 = [40 50 70]

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Just use it like:

print(arr_2[arr_idx_num_3])

output:

>>> [40 50 70]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading