热心网友
回答时间:2025-01-24 13:03
Sum of array elements over a given axis.
Parameters :
a : array_like
Elements to sum.
axis : integer, optional
Axis over which the sum is taken. By default axis is None,and all elements are summed.
dtype : dtype, optional
The type of the returned array and of the accumulator in whichthe elements are summed. By default, the dtype of a is used.An exception is when a has an integer type with less precisionthan the default platform integer. In that case, the defaultplatform integer is used instead.
out : ndarray, optional
Array into which the output is placed. By default, a new array iscreated. If out is given, it must be of the appropriate shape(the shape of a with axis removed, i.e.,numpy.delete(a.shape, axis)). Its type is preserved. Seedoc.ufuncs (Section “Output arguments”) for more details.
Returns :
sum_along_axis : ndarray
An array with the same shape as a, with the specifiedaxis removed. If a is a 0-d array, or if axis is None, a scalaris returned. If an output array is specified, a reference toout is returned.
收起