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 / size

_ArrayFunctionDispatcher

numpy:size

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/_core/fromnumeric.py :3525

Signature

def   size ( a axis = None )

Summary

Return the number of elements along a given axis.

Parameters

a : array_like

Input data.

axis : None or int or tuple of ints, optional

Axis or axes along which the elements are counted. By default, give the total number of elements.

Returns

element_count : int

Number of elements along the specified axis.

Examples

import numpy as np
a = np.array([[1,2,3],[4,5,6]])
np.size(a)
np.size(a,axis=1)
np.size(a,axis=0)
np.size(a,axis=(0,1))

See also

ndarray.shape

dimensions of array

ndarray.size

number of elements in array

shape

dimensions of array

Aliases

  • numpy.size