Hi, friends. I wanna ask if there is a function which is able to take a list as argument and then return its top-k maximums?

Jo Chan csjcg2 at gmail.com
Thu Apr 22 10:07:54 EDT 2010


Cool! Thanks a lot! That's exactly what I want.

Best regards,

Songjian

On Thu, Apr 22, 2010 at 10:04 PM, Chris Rebert <crebert at ucsd.edu> wrote:

> 2010/4/22 Jo Chan <csjcg2 at gmail.com>:
> > Hi,friends.
> >  I wanna ask if there is a function which is able to take a list as
> argument
> > and then return its top-k maximums?
> > I only know about max which is poorly a top-1 maximum function, now I
> want
> > more yet I am lazy enough that don't want to write one by myself.
>
> http://docs.python.org/library/heapq.html#heapq.nlargest
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
>



-- 
------------------
Best Regards

陈松坚
信息科学与技术学院 中山大学 广州大学城 510006
Chen Songjian
School of Information Science & Technology
Sun Yat-sen(Zhongshan) University, Guangzhou Higher Education Mega Center,
China, 510006
Mobile: +86-137-6069-6137
Email:  csjcg2 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100422/3016e7fe/attachment.html>


More information about the Python-list mailing list