...

Web Technologies - NumPy

Back to Course

Lesson Description


Lession - #299 NumPy Array Shape


Shape of an Array

The Shape of an array is the quantity of components in each aspect.

Get the Shape of an Array
NumPy array have a property considered shape that profits a tuple with each index having the quantity of comparing components.
Example
Print the shape of a 2-D array:
import numpy as np

arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]>
print(arr.shape>


Example
Make an array with 5 aspects utilizing ndmin utilizing a vector with values 1,2,3,4 and confirm that last aspect has esteem 4:
import numpy as np

arr = np.array([1, 2, 3, 4], ndmin=5>
print(arr>
print('shape of array :', arr.shape>










numpy tile . Construct an array by repeating A the number of times given by reps.
Numpy min(>
function is used to get a minimum value along a specified axis.
Learn how to create Numpy array, from one dimension to any dimension you want in this series of Numpy tutorials.
How to convert list to dictionary Python ; Input : ['Name' · 'Abhinay' · 'age' · 25 · 'Marks' ; Output : {'Name' · 'Abhinay' · 'age' · 25 · 'Marks' ;