This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / core / size

function

numpy.ma.core:size

source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :7764

Signature

def   size ( obj 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.ma.size