{ } Raw JSON

bundles / numpy 2.4.4 / numpy / _core / fromnumeric / size

function

numpy._core.fromnumeric:size

source: /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._core.shape_base._size