Python numpy ndim() function

Here, I’ll discuss about Python numpy ndim() function. It returns total dimensions of the array. ndim() actually tells us, that array is one dimensional (1-D), two dimensional (2-D), Three dimensional(3-D) and so on…..

Syntax:

You can use python numpy ndim() function in two ways

No#1

No#2

 

Parameter:

ndim function takes just single parameter

array_name: It is actually a ndarray, whose dimensions we want to check

 

 

see the examples below to understand

Example #1

In this example we will check the 1-D array dimensions in 2 ways

 

 

Example #2

In this example we will check the 2-D array dimensions in 2 ways

 

 

Start with Numpy

 

Python numpy.concatenate()