Advanced Indexing Techniques on NumPy Arrays - Learn NumPy Series

preview_player
Показать описание
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!
Рекомендации по теме
Комментарии
Автор

This tutorial just solved my problem. Thank you!

LucasDimoveo
Автор

Is their any way to speed up mask, slicing is very fast with small and big data but mask slow with big data

Caelghoul
Автор

which software you use for in this video

sourabhyeshal
Автор

Is it possible to keep the shape of multiple logic conditions instead of getting a one dimensional array?

jeremydeceuster
Автор

Thanks man, nice video. Now I fully understand numpy:)
One question tho. There’s not that much to learn about numpy, are there?

elliottandreasen
Автор

which editor software
use in this video

sourabhyeshal
Автор

can i get some more help with indexing and slicing please

gracioushouse
Автор

Hi can anyone help me to solve this
write a code to identify indexes where a shift happens and fetch corresponding value from another array


array1=(0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1)
array2=(a, b, c.d.e.f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

the final output should be two arrays, one should contain elements fetched from array2 and the other should contain numbers of the shifts

final: ['d', 'i', 'm', 'p', 's', 'x']
Indexes: [3, 8, 12, 15, 18, 23]

janudhivyaradhakrishnan