Learn practical skills, build real-world projects, and advance your career
Created 2 years ago
import numpy as np
# List of functions explained
function1 = np.nditer()
function2 = np.split()
function3 = np.extract()
function4 = np.stack()
function5 = np.transpose()
# nditer function is used for iterating through elements of array.
# This function help us to solve some basic Issues which we face in iteration
# when we want to iterate through nD array we need to use n for loops which can be difficult to write for arrays
# with very high dimensionality.
# Function #1 :
arr = np.array([[[1 , 2 , 3] ,
[4 , 5 , 6]],
[[7 , 8 , 9] ,
[10 , 11 , 12]]])
# Example #1 (working)
for i in np.nditer(arr) :
print(i)
print("The Shape of Array is :" , arr.shape)
1
2
3
4
5
6
7
8
9
10
11
12
The Shape of Array is : (2, 2, 3)