numpy之sum

Definition : sum(a, axis=None, dtype=None, out=None, keepdims=False)

axis: None or int or tuple of ints, optional

Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.

New in version 1.7.0.

If axis is a tuple of ints, a sum is performed on all of the axes specified in the tuple instead of a single axis or all the axes as before.

原文地址:https://www.cnblogs.com/ylHe/p/6001239.html