finding most common elements between thousands of multiple arrays.

Emile van Sebille emile at fenx.com
Sat Jul 4 21:00:29 EDT 2009


On 7/4/2009 12:33 AM mclovin said...
> Currently I need to find the most common elements in thousands of
> arrays within one large array (arround 2 million instances with ~70k
> unique elements)
> 
> so I set up a dictionary to handle the counting so when I am
> iterating  I 

   ** up the count on the corrosponding dictionary element **

Right at this point, instead of or in addition to counting, why not save 
the large array index in a list?  Then when you've identified the 25 
most common elements you'll already have a list of pointer to the 
instances to work from.

Emile





More information about the Python-list mailing list