Indexing and Slicing NumPy Arrays | Module NumPy Tutorial - Part 08

Опубликовано: 10 Март 2025
на канале: Koolac
1,427
44

Indexing and Slicing numpy arrays (1D and 2D and 3D examples) in numpy module

==================================
NumPy Module Tutorial Playlist for Machine Learning:
==================================
   • Numpy Python Playlist  

==================================
⏱TIMESTAMPS⏱:
==================================
0:00 - NumPy 1D arrays Slicing and Indexing
4:18 - NumPy 2D arrays Slicing and Indexing
7:16 - NumPy 3D arrays Slicing and Indexing

==================================
Source Code [1]:
==================================
import numpy as np
0 1 2 3
x=np.array([60,100,114,40])
-4 -3 -2 -1
print(x[1:])

==================================
Source Code [2]:
==================================
import numpy as np
x=np.array([
[100,50,40], # row 0
[114,70,10], # row 1
[900,99,14] # row 2
0 1 2
])
print(x[1:,2])

==================================
Source Code [3]:
==================================
import numpy as np
x=np.array([
[[1,2],
[3,4]],

[[5,6],
[7,8]]
])
print(x[1,0,1])