finding most common elements between thousands of multiple arrays.

Peter Otten __peter__ at web.de
Mon Jul 6 08:33:53 CEST 2009


Scott David Daniels wrote:

> Scott David Daniels wrote:

>      t = timeit.Timer('sum(part[:-1]==part[1:])',
>                       'from __main__ import part')

What happens if you calculate the sum in numpy? Try

t = timeit.Timer('(part[:-1]==part[1:]).sum()',
                 'from __main__ import part')


Peter




More information about the Python-list mailing list