🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndim.html
numpy.ndim — NumPy v2.6.dev0 Manual
>>> import numpy as np >>> np.ndim([[1,2,3],[4,5,6]]) 2 >>> np.ndim(np.array([[1,2,3],[4,5,6]])) 2 >>> np.ndim(1) 0
numpy.shape
Return the shape of an array · The elements of the shape tuple give the lengths of the corresponding array dimensions
numpy.reshape
Returns a reshaped ndarray without changing data · Array to be reshaped
numpy.concatenate
Join a sequence of arrays along an existing axis · Added in version 2.0: numpy.concat added as a shorthand for numpy.concatenate
numpy.ndarray.flatten
Return a copy of the array collapsed into one dimension · ‘C’ means to flatten in row-major (C-style) order. ‘F’ means to flatten in column-major (Fortran- style) order. ‘A’ means to flatten in column-major order if a is Fortran contiguous in memory, row-major order otherwise.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.6.dev0 Manual
>>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.3 Manual
>>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.5 Manual
>>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.1 Manual
ndarray.ndim# Number of array dimensions. Examples · >>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 ·
🌐
Codecademy
codecademy.com › docs › python:numpy › ndarray › ndim
Python:NumPy | ndarray | ndim | Codecademy
November 5, 2025 - The ndim attribute returns the total number of dimensions (axes) of a NumPy array.
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.0 Manual
ndarray.ndim# Number of array dimensions. Examples · >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 ·
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Get the dimensions, shape, and size of an array | note.nkmk.me
April 23, 2025 - You can get the number of dimensions of a NumPy array as an integer using the ndim attribute.
Find elsewhere
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v2.2 Manual
ndarray.ndim# Number of array dimensions. Examples · >>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 ·
🌐
GeeksforGeeks
geeksforgeeks.org › machine learning › numpy-ndarray-ndim-method-python
numpy.ndarray.ndim() method | Python - GeeksforGeeks
March 26, 2020 - numpy.ndarray.ndim() function return the number of dimensions of an array. Syntax : numpy.ndarray.ndim(arr) Parameters : arr : [array_like] Input array. If it is not already an ndarray, a conversion is attempted.
🌐
NumPy
numpy.org › doc › stable › › reference › generated › numpy.ndim.html
numpy.ndim — NumPy v2.5 Manual
>>> import numpy as np >>> np.ndim([[1,2,3],[4,5,6]]) 2 >>> np.ndim(np.array([[1,2,3],[4,5,6]])) 2 >>> np.ndim(1) 0
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.matrix.ndim.html
numpy.matrix.ndim — NumPy v2.5 Manual
matrix.ndim# Number of array dimensions. Examples · Try it in your browser! >>> import numpy as np >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 · Go BackOpen In Tab ·
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.ndim.html
numpy.ndim — NumPy v2.0 Manual
numpy.ndim(a)[source]# Return the number of dimensions of an array. Parameters: aarray_like · Input array. If it is not already an ndarray, a conversion is attempted. Returns: number_of_dimensionsint · The number of dimensions in a. Scalars are zero-dimensional.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.ndim.html
numpy.ndim — NumPy v2.3 Manual
>>> import numpy as np >>> np.ndim([[1,2,3],[4,5,6]]) 2 >>> np.ndim(np.array([[1,2,3],[4,5,6]])) 2 >>> np.ndim(1) 0
🌐
NumPy
numpy.org › doc › 1.25 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v1.25 Manual
ndarray.ndim# Number of array dimensions. Examples · >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 ·
🌐
W3Schools
w3schools.com › python › numpy › numpy_creating_arrays.asp
NumPy Creating Arrays
NumPy Arrays provides the ndim attribute that returns an integer that tells us how many dimensions the array have.
🌐
NumPy
numpy.org › doc › 1.15 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v1.15 Manual
numpy.ndarray.data · ndarray.ndim¶ · Number of array dimensions. Examples · >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 · © Copyright 2008-2018, The SciPy community. Last updated on Nov 04, 2018.
🌐
SciPy
docs.scipy.org › doc › numpy-1.13.0 › reference › generated › numpy.ndarray.ndim.html
numpy.ndarray.ndim — NumPy v1.13 Manual
June 10, 2017 - numpy.ndarray · index · next · previous · ndarray.ndim¶ · Number of array dimensions. Examples · >>> x = np.array([1, 2, 3]) >>> x.ndim 1 >>> y = np.zeros((2, 3, 4)) >>> y.ndim 3 · numpy.ndarray.nbytes · numpy.ndarray.shape · © Copyright 2008-2009, The Scipy community.