我有一個看起來像這樣的輸入文件,我想計算分鐘的響應時間。分析響應時間分明python
datapoint,time,transaction,PT,Responsetime,errorcode
a06i0000003uNQOAA2,2013-09-26T19:15:55.873+0000,EditMode,57,109.877193,0
a06i0000003uNQOAA2,2013-09-26T19:15:55.875+0000,Update,58,733.741379,0
a06i0000003uNQOAA2,2013-09-26T19:15:55.875+0000,ViewObject,94,386.893617,0
a06i0000003uNQOAA2,2013-09-26T19:16:25.889+0000,EditMode,110,109.209091,0
a06i0000003uNQOAA2,2013-09-26T19:16:25.889+0000,Update,109,743.660550,0
a06i0000003uNQOAA2,2013-09-26T19:16:25.890+0000,ViewObject,181,376.198895,0
a06i0000003uNQOAA2,2013-09-26T19:16:55.904+0000,EditMode,162,109.080247,0
a06i0000003uNQOAA2,2013-09-26T19:16:55.904+0000,Update,161,738.683230,0
a06i0000003uNQOAA2,2013-09-26T19:16:55.904+0000,ViewObject,266,372.627820,0
a06i0000003uNQOAA2,2013-09-26T19:17:25.918+0000,EditMode,212,108.580189,0
a06i0000003uNQOAA2,2013-09-26T19:17:25.919+0000,Update,213,735.244131,0
a06i0000003uNQOAA2,2013-09-26T19:17:25.919+0000,ViewObject,350,362.394286,0
a06i0000003uNQOAA2,2013-09-26T19:17:55.933+0000,EditMode,263,107.954373,0
a06i0000003uNQOAA2,2013-09-26T19:17:55.933+0000,Update,264,732.598485,0
a06i0000003uNQOAA2,2013-09-26T19:17:55.934+0000,ViewObject,431,359.965197,0
a06i0000003uNQOAA2,2013-09-26T19:18:25.947+0000,EditMode,314,107.815287,0
a06i0000003uNQOAA2,2013-09-26T19:18:25.948+0000,Update,315,733.292063,0
a06i0000003uNQOAA2,2013-09-26T19:18:25.948+0000,ViewObject,516,360.098837,0
a06i0000003uNQOAA2,2013-09-26T19:18:55.961+0000,EditMode,368,107.559783,0
a06i0000003uNQOAA2,2013-09-26T19:18:55.961+0000,Update,366,731.808743,0
a06i0000003uNQOAA2,2013-09-26T19:18:55.962+0000,ViewObject,600,359.780000,0
a06i0000003uNQOAA2,2013-09-26T19:19:25.975+0000,EditMode,418,107.406699,0
a06i0000003uNQOAA2,2013-09-26T19:19:25.976+0000,Update,419,731.613365,0
a06i0000003uNQOAA2,2013-09-26T19:19:25.976+0000,ViewObject,686,358.169096,0
a06i0000003uNQOAA2,2013-09-26T19:19:55.989+0000,EditMode,470,107.265957,0
a06i0000003uNQOAA2,2013-09-26T19:19:55.990+0000,Update,467,732.107066,0
a06i0000003uNQOAA2,2013-09-26T19:19:55.990+0000,ViewObject,768,360.317708,0
a06i0000003uNQOAA2,2013-09-26T19:20:26.003+0000,EditMode,521,107.149712,0
a06i0000003uNQOAA2,2013-09-26T19:20:26.004+0000,Update,521,733.990403,0
a06i0000003uNQOAA2,2013-09-26T19:20:26.004+0000,ViewObject,853,361.735053,0
a06i0000003uNQOAA2,2013-09-26T19:20:56.018+0000,EditMode,572,107.117133,0
a06i0000003uNQOAA2,2013-09-26T19:20:56.018+0000,Update,572,733.139860,0
a06i0000003uNQOAA2,2013-09-26T19:20:56.018+0000,ViewObject,937,361.497332,0
a06i0000003uNQOAA2,2013-09-26T19:21:26.032+0000,EditMode,623,106.855538,0
a06i0000003uNQOAA2,2013-09-26T19:21:26.032+0000,Update,623,732.057785,0
a06i0000003uNQOAA2,2013-09-26T19:21:26.032+0000,ViewObject,1020,361.191176,0
a06i0000003uNQOAA2,2013-09-26T19:21:56.046+0000,EditMode,674,107.112760,0
a06i0000003uNQOAA2,2013-09-26T19:21:56.046+0000,Update,674,731.721068,0
a06i0000003uNQOAA2,2013-09-26T19:21:56.046+0000,ViewObject,1106,360.622966,0
a06i0000003uNQOAA2,2013-09-26T19:22:26.059+0000,EditMode,724,107.041436,0
這是我想出來的程序,這是給我的整個響應時間,而不是每一分鐘的具體。不知道我哪裏錯了。任何指針將不勝感激。
import numpy as np
from scipy import stats
rtlist = []
reqpslist = []
newFile = open('100ulog.csv','r')
FILE = newFile.readlines()
newFile.close()
for line in FILE:
newline1 = line.split(":")
newline2 = line.split(",")
min = newline1[1]
if newline1[1] == min:
rtlist.append(newline2[4])
reqpslist.append(newline2[3])
print rtlist
else:
rtlist[:] = []
min = min+1
什麼是你想要的輸出這是真的* *不明確 –
另外,分配'NEWLINE1 [1]'來'min'然後驗證它們相等什麼與回事 –