diff options
author | edschofield <edschofield@localhost> | 2005-10-27 15:08:34 +0000 |
---|---|---|
committer | edschofield <edschofield@localhost> | 2005-10-27 15:08:34 +0000 |
commit | 4e736713fb9865aae3e889c48420ddaf1fe4fa69 (patch) | |
tree | 53f786f9bd1f039987b1b8c77f30cd64780de12d /scipy/base/function_base.py | |
parent | fa94504b1eee72c89ebe4503969781ebf903c3b7 (diff) | |
download | numpy-4e736713fb9865aae3e889c48420ddaf1fe4fa69.tar.gz |
More docstring fixes for mean() and sum().
Diffstat (limited to 'scipy/base/function_base.py')
-rw-r--r-- | scipy/base/function_base.py | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/scipy/base/function_base.py b/scipy/base/function_base.py index 1c221c3b7..382ccdefb 100644 --- a/scipy/base/function_base.py +++ b/scipy/base/function_base.py @@ -127,32 +127,29 @@ def histogram(a, bins=10, range=None, normed=False): def average(a, axis=0, weights=None, returned=False): """average(a, axis=0, weights=None, returned=False) - Compute average over the given axis. If 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. - - The average of an integer or floating-point array always has type - Float. - - If an integer axis is given, this equals: - a.sum(axis) * 1.0 / len(a) - - If axis is None, this equals: - a.sum(axis) * 1.0 / product(a.shape) - - If weights are given, result is: - sum(a * weights) / sum(weights), - where the weights must have a's shape or be 1D with length the - size of a in the given axis. Integer weights are converted to - Float. Not specifying weights is equivalent to specifying - weights that are all 1. - - If 'returned' is True, return a tuple: the result and the sum of - the weights or count of values. The shape of these two results - will be the same. - - Raises ZeroDivisionError if appropriate. (The version in MA does - not -- it returns masked values). + 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. + + If an integer axis is given, this equals: + a.sum(axis) * 1.0 / len(a) + + If axis is None, this equals: + a.sum(axis) * 1.0 / product(a.shape) + + If weights are given, result is: + sum(a * weights) / sum(weights), + where the weights must have a's shape or be 1D with length the + size of a in the given axis. Integer weights are converted to + Float. Not specifying weights is equivalent to specifying + weights that are all 1. + + If 'returned' is True, return a tuple: the result and the sum of + the weights or count of values. The shape of these two results + will be the same. + + Raises ZeroDivisionError if appropriate. (The version in MA does + not -- it returns masked values). """ if axis is None: a = array(a).ravel() |