User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 423,212 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,860 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums

Finding top 10 values in csv file

Join Date: Jul 2006
Posts: 562
Reputation: jrcagle is on a distinguished road 
Rep Power: 4
Solved Threads: 72
jrcagle jrcagle is offline Offline
Posting Pro

Re: Finding top 10 values in csv file

  #6  
May 10th, 2008
Oh, well if you must iterate, then here's the basic idea:

* create an empty list.
* run through the data by rows.
* if the current row's earnings are greater than the smallest earnings in your list:
--- add the current row's earnings and name of company to the list.
--- sort the list.
--- trim the list to 10 items
* Voila!

I'll leave the coding to you.

Jeff
Reply With Quote  
All times are GMT -4. The time now is 9:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC