You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / _core / fromnumeric / ndim

function

numpy._core.fromnumeric:ndim

source: /numpy/_core/fromnumeric.py :3482

Signature

def   ndim ( a )

Summary

Return the number of dimensions of an array.

Parameters

a : array_like

Input array. If it is not already an ndarray, a conversion is attempted.

Returns

number_of_dimensions : int

The number of dimensions in a. Scalars are zero-dimensional.

Examples

import numpy as np
np.ndim([[1,2,3],[4,5,6]])
np.ndim(np.array([[1,2,3],[4,5,6]]))
np.ndim(1)

See also

ndarray.ndim

equivalent method

ndarray.shape

dimensions of array

shape

dimensions of array

Aliases

  • numpy._core.shape_base._ndim