numpy choosing groups / clusters of values

T Kirstine travispython at gmail.com
Wed Apr 29 16:42:57 EDT 2009


I have a numpy array and would like to get the values from the array where
groups  of values are the same.

Select the groups of 0 where group is > 3 and change 0 to 5

This
[3, 2, 1, 0, 0],
[1, 0, 3, 0, 0],
[2, 0, 1, 3, 0],
[0, 2, 3, 3, 0]

to this
[3, 2, 1, 5, 5],
[1, 0, 3, 5, 5],
[2, 0, 1, 3, 5],
[0, 2, 3, 3, 5]

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090429/a8c66e18/attachment.html>


More information about the Python-list mailing list