Count instances of csv value > value using python -
i trying count number of times value in csv file greater selected value in each of last 2 columns. how that? data looks this.
date_time,branch-to-phx,phx-to-branch
mon aug 14 11:55:00 2017,0,22.2967133333333
mon aug 14 12:00:00 2017,0,35.9166666666667
mon aug 14 12:05:00 2017,4.70542333333333,23.7121266666667
mon aug 14 12:10:00 2017,2.66666666666667,20.5768133333333
mon aug 14 12:15:00 2017,0,32.99983
mon aug 14 12:20:00 2017,0,26.3703266666667
mon aug 14 12:25:00 2017,0,26.11117
mon aug 14 12:30:00 2017,0,20.5476
mon aug 14 12:35:00 2017,0,0
code below
url1 = "http://tlpamtr-1/cgi-bin/14all.cgi?&csv=1&rrd=branch-" url2 = "_tstat_tcp-loss-pct.rrd&cfg=" url3 = "-tstat.cfg&cf=average&range=2400&fact=1" #print "enter branch list:" #user_dv = sys.stdin.readlines() # used test code below user_dv = ['5555\n', '4103\n', '14432\n'] #used user_dv above #print "collecting data" brn in user_dv: brn = brn.strip("\n") brn = brn.zfill(5) #urllib.urlretrieve (url1 + brn + url2 + brn + url3, brn + ".csv") brtophx = 0 phxtobr = 0 open(brn + ".csv" , 'r') mrtg: csvfile=mrtg.readlines() in range(1,len(csvfile)): print csvfile[i]
Comments
Post a Comment