def moment(a, moment=<NUM_LIT:1>, axis=<NUM_LIT:0>):
a, axis = _chk_asarray(a, axis)<EOL>if moment == <NUM_LIT:1>:<EOL><INDENT>shape = list(a.shape)<EOL>del shape[axis]<EOL>if shape:<EOL><INDENT>return np.zeros(shape, dtype=float)<EOL><DEDENT>else:<EOL><INDENT>return np.float64(<NUM_LIT:0.0>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>mn = np.expand_dims(np.mean(a,axis), axis)<EOL>s = np.power((a-mn), moment)<EOL>return np.mean(s, axis)<EOL><DEDENT>
Calculates the nth moment about the mean for a sample.

Generally used to calculate coefficients of skewness and
kurtosis.

Parameters
----------
a : array_like
   data
moment : int
   order of central moment that is returned
axis : int or None
   Axis along which the central moment is computed. If None, then the data
   array is raveled. The default axis is zero.

Returns
-------
n-th central moment : ndarray or float
   The appropriate moment along the given axis or over all values if axis
   is None. The denominator for the moment calculation is the number of
   observations, no degrees of freedom correction is done.