python - How can I make sure the greater number is placed first? -


i have program works on logfile narrow down 2 items. program works great except gets 2 numbers backwards. example, 2 numbers ends should [1700, 1650], not [1650, 1700]. how can make sure higher value number listed first [0] , lower number listed second [1]?

import pylab   pylab import *   numpy import *   collections import counter    list_of_files=[('logfile.txt', 'temp')]   datalist = [( pylab.loadtxt(filename), label ) filename, label in list_of_files]   data, label in datalist:     pylab.plot( data[:,0], data[:,1], label=label )     print data [:,1]       temps = [k k,v in counter(data[:,1]).items() if v>1 , 1500<=k<2200]     print temps    print ("test="), 0.555*(temps[0]-32)+.651*(temps[1]-32)   

you can reverse sort list this:

temps = [k k,v in counter(data[:,1]).items() if v>1 , 1500<=k<2200] temps = sorted(temps, reverse=true) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -