summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2006-07-07 16:24:53 +0000
committerStefan van der Walt <stefan@sun.ac.za>2006-07-07 16:24:53 +0000
commit6dc0d80179c589f12bfef76a9564b28c450437d0 (patch)
tree00543ec6f5e82f548a009dedae36ea023932c389 /numpy/lib/function_base.py
parent797911288ad649bded549b13492c4fb5d240ee79 (diff)
downloadnumpy-6dc0d80179c589f12bfef76a9564b28c450437d0.tar.gz
Add docstring for bincount.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 74352ac9a..9969834a8 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -21,8 +21,9 @@ from numpy.core.fromnumeric import ravel, nonzero, choose, sort
from numpy.core.numerictypes import typecodes
from numpy.lib.shape_base import atleast_1d
from numpy.lib.twodim_base import diag
-from _compiled_base import bincount, _insert, add_docstring
+from _compiled_base import _insert, add_docstring
from _compiled_base import digitize as _digitize
+from _compiled_base import bincount as _bincount
#end Fernando's utilities
@@ -387,6 +388,18 @@ def digitize(x,bins):
Beyond the bounds of the bins 0 or len(bins) is returned as appropriate.
"""
return _digitize(x,bins)
+
+def bincount(x,weights=None):
+ """Count the number of occurrences of each value in x.
+
+ x must be a list of non-negative integers. The output, b[i],
+ represents the number of times that i is found in x. If weights
+ is specified, every occurrence of i at a position p contributes
+ weights[p] instead of 1.
+
+ See also: histogram, digitize, unique.
+ """
+ return _bincount(x,weights)
def angle(z, deg=0):
"""Return the angle of the complex argument z.