[Numpy-discussion] why is default axis always different?

Sven Schreiber svetosch at gmx.net
Fri Aug 11 17:23:01 CDT 2006

notice the (confusing, imho) different defaults for the axis of the
following related functions:

nansum(a, axis=-1)
    Sum the array over the given axis, treating NaNs as 0.

sum(x, axis=None, dtype=None)
    Sum the array over the given axis.  The optional dtype argument
    is the data type for intermediate calculations.

average(a, axis=0, weights=None, returned=False)
    average(a, axis=0, weights=None, returned=False)

    Average the array over the given axis.  If the axis is None, average
    over all dimensions of the array.  Equivalent to a.mean(axis), but
    with a default axis of 0 instead of None.

>>> numpy.__version__

Shouldn't those kind of functions have the same default behavior? So is
this a bug or am I missing something?

Thanks for enlightenment,

More information about the Numpy-discussion mailing list