NumPy Array Advanced Indexing Practice - Learn NumPy Series

preview_player
Показать описание
This video is apart of a full learn NumPy series. Check out the playlist here:

In this one we'll get some more practice indexing numpy arrays with some advanced methods. Try the projects out too and let me know how you do them!

Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter!

Thanks for all the support! 4960+ subscribers! How incredible. Thank you all for continuing to support me on this journey.

*****************************************************************
Full code from the video:
import numpy as np

# Introduce arange function
print(array_a)

print(array_a)

# Return Every Last Value of Row with Negative Indexing
print(array_a[:,-1])

# boolean practice:
array_above_50 = array_a[array_a #greater than (YouTube Description doesn't allow angle brackets 50]
print(array_above_50)

#Indexing using Python Slices on one dimensional array
print(array_above_50[0:len(array_above_50):2])

#Taking Slice from Each Row of Array
print(array_a[:,0:5:2])

# Challenges Reverse each array row using negative indexing.
# index all values greater than 20 and less than 75, make everything else a value of zero and retain shape.

Packages (& Versions) used in this video:
Python 3.7
NumPy 1.17

*****************************************************************
Code from this tutorial and all my others can be found on my GitHub:

Check out my website:

If you liked the video - please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!!

Always looking for suggestions on what video to make next -- leave me a comment with your project! Happy Coding!
Рекомендации по теме
Комментарии
Автор

hi, need help. how could i get this(replace two rows with ones)
array([[1, 1, 1],
[1, 1, 1],
[0, 4, 4],
[3, 3, 4],
[1, 3, 0]])

with a np.where function. I could not figure the right syntax for the condition

yndolokoppavel
Автор

Challenge one: matrix[:, ::-1], challenge two: matrix.where((matrix<75)&(matrix>20), matrix, 'value' ). Am I right?

yuliu
Автор

Challenge 1) print (array_a_reshape[:, -1:-4:-1])
Challenge 2)
betwen_25_and_75 = 20, array_a_reshape < 75)
result =
reshape_the_result = result.reshape(2, 5)
print (reshape_the_result)

I know I'm wrong with the 2nd challenge can anyone help me?

alexteka