filmov
tv
Advanced Indexing Techniques on NumPy Arrays - Learn NumPy Series
Показать описание
This video is apart of a full Learn NumPy Series-
In this one we'll look at how we can begin using advanced indexing methods on our NumPy Arrays
#Python #NumPy #Tutorial
Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter!
We're at 4950+ Subscribers at the time of writing this! How awesome. Thanks so much everyone. Your support is phenomenal. Super honored by all the kind words and comments.
*****************************************************************
Full code from the video:
import numpy as np
row_1 = [1,2,3,4,5]
row_2 = [6,7,8,9,10]
row_3 = [11,12,13,14,15]
row_4 = [16,17,18,19,20]
row_5 = [21,22,23,24,25]
print(test_data)
# Using Python Slices
print(test_data[:,2:4:1])
# Same Elements but reversed
print(test_data[:,-2:-4:-1])
#boolean index
greater_than_five = test_data != 5
# returns one dimensional array
print(greater_than_five)
# single line operation
print(test_data[greater_than_five])
print(test_data[test_data!=5])
# But what if we wanted to retain shape?
print(drop_under_5_array)
# Using Multiple Logic Conditions
# YouTube Description doesn't allow angled brackets :(
print(drop_under_5_and_over_20)
print(test_data[drop_under_5_and_over_20])
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!
In this one we'll look at how we can begin using advanced indexing methods on our NumPy Arrays
#Python #NumPy #Tutorial
Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter!
We're at 4950+ Subscribers at the time of writing this! How awesome. Thanks so much everyone. Your support is phenomenal. Super honored by all the kind words and comments.
*****************************************************************
Full code from the video:
import numpy as np
row_1 = [1,2,3,4,5]
row_2 = [6,7,8,9,10]
row_3 = [11,12,13,14,15]
row_4 = [16,17,18,19,20]
row_5 = [21,22,23,24,25]
print(test_data)
# Using Python Slices
print(test_data[:,2:4:1])
# Same Elements but reversed
print(test_data[:,-2:-4:-1])
#boolean index
greater_than_five = test_data != 5
# returns one dimensional array
print(greater_than_five)
# single line operation
print(test_data[greater_than_five])
print(test_data[test_data!=5])
# But what if we wanted to retain shape?
print(drop_under_5_array)
# Using Multiple Logic Conditions
# YouTube Description doesn't allow angled brackets :(
print(drop_under_5_and_over_20)
print(test_data[drop_under_5_and_over_20])
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!
Комментарии