This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / _core / fromnumeric / ndim

function

numpy._core.fromnumeric:ndim

source: build-install/usr/lib/python3.14/site-packages/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