On 12-Nov-09, at 6:09 PM, josef.p...@gmail.com wrote:

> On Thu, Nov 12, 2009 at 6:00 PM, Priit Laes <pl...@plaes.org> wrote:
>> Hey,
>>
>> I cooked up an initial implementation for one-dimensional
>> histogram_discrete().
>>
>> Example:
>>
>>>> import numpy
>>>> numpy.histogram_discrete([-1, 9, 9, 0, 3, 5, 3])
>> array([1, 1, 0, 0, 2, 0, 1, 0, 0, 0, 2])
>>>> numpy.histogram_discrete([-99999, 99999])
>> array([1, 0, 0, ..., 0, 0, 1])
>>
>> Suggestions, criticism? :)

> Is there a difference to numpy.bincount ?


Time to add to this to the FAQ (FWIW I've reinvented the wheel a  
number of times too).

Though, np.bincount does not handle negatives -- I kind of like it  
that way though.

David
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to