diff options
author | Pauli Virtanen <pav@iki.fi> | 2011-03-25 22:25:53 +0100 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2011-03-25 22:25:53 +0100 |
commit | cf42ec0dc81ad4e7b1a1929d12518297defebed7 (patch) | |
tree | ff798eede412c59be80a2b6185d6e458e8271a43 /numpy/lib/function_base.py | |
parent | ac2c160c5b0ad5a420543b94a1896f5e45f67b97 (diff) | |
download | numpy-cf42ec0dc81ad4e7b1a1929d12518297defebed7.tar.gz |
DOC: lib: point the reader towards masked arrays when there is missing data
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index f04018cce..0944e0ef0 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -421,26 +421,12 @@ def average(a, axis=None, weights=None, returned=False): When the length of 1D `weights` is not the same as the shape of `a` along axis. - Notes - ----- - When the array `a` contains `None` values, this function will throw - an error. If you would like to calculate the average without the `None` - values in the calculation, the `list comprehension`_ feature in Python - is a great way to do that. If you're new to Python, learning about - list comprehensions is well worth your while, as they make - manipulating and filtering lists very convenient. - - .. _list comprehension: http://docs.python.org/tutorial/datastructures.html#list-comprehensions - - >>> a = [1, None, 2, None] - >>> np.average([x for x in a if x != None]) - 1.5 - See Also -------- mean - ma.average : average for masked arrays + ma.average : average for masked arrays -- useful if your data contains + "missing" values Examples -------- |