def plotPredictError(): filePart0 = ["F:\\one\\predict\\GM/wc", "F:\\one\\final\\inmin/workload"] wrFile = WRFile() filePart1 = [".xlsx", "inmin.xlsx"] x = [] x_label = [] k = 0 for i in range(53, 61): predict = wrFile.readDataFromExcel(filePath=filePart0[0] + str(i) + filePart1[0]) data = wrFile.readDataFromExcel(filePath=filePart0[1] + str(i) + filePart1[1]) dis = (predict - data) / data * 100 over = [] under = [] for j in range(len(dis)): if dis[j] > 0: over.append(dis[j]) else: under.append(-dis[j]) #x.insert(k,over) k += 1 x.insert(k, under) x_label.append(str(i) + "-o") #x_label.append(str(i)+"-u") plt.boxplot(x=x, labels=(53, 54, 55, 56, 57, 58, 59, 60), notch=True, patch_artist=True) plt.grid(True) plt.title("analyze the under-prediction error of Grey Model")
def learnChangeRate(self,day): wrFile = WRFile() day = int(day) windows = 3 part0 = "F:\\one\\predict\\traindata/workload" part1 = "inmin.xlsx" if day <=53: data = wrFile.readDataFromExcel(part0+str(53)+part1) self.changeRate = np.zeros(len(data)-1) elif day>53: if (day-windows)<53: windows = day-53+1 else: windows+=1 cr = np.zeros(1440-1) #print("day is",day,"windows is",windows) for i in range(1,windows): data = wrFile.readDataFromExcel(part0+str(day-i)+part1) cr += np.diff(data)/data[:len(data)-1] self.changeRate = cr/(windows-1) #print("windows is",windows-1) #plt.plot(np.arange(len(self.changeRate)),self.changeRate)
def lowPearson(): filePart0 = [ "F:\\one\\predict\\GM/wc", "F:\\one\\final\\inmin/workload", "F:\\one\\final\inmin\\knots/workload" ] wrFile = WRFile() filePart1 = [".xlsx", "inmin.xlsx", "inmin_knots.xlsx"] Hours = [[15, 17, 19, 21], [15, 17, 21], [17], [14, 22], [14, 22], [17, 19, 22], [14, 15, 16, 20, 22], [14, 16, 21]] CRinLowP = [] PRinLowP = [] x = [] DatainLowP = np.zeros(60 * 8 * 24) PredinLowP = np.zeros(60 * 8 * 24) for i in range(53, 61): day = i - 53 predict = wrFile.readDataFromExcel(filePath=filePart0[0] + str(i) + filePart1[0]) data = wrFile.readDataFromExcel(filePath=filePart0[1] + str(i) + filePart1[1]) CR = np.diff(data) / data[:len(data) - 1] * 100 #计算负载的变化率 PR = (predict - data) / data * 100 #计算预测精度 PR = PR[1:] #定位到指定时刻 h = 0 while h < len(Hours[day]): time = (Hours[day])[h] * 60 CRinLowP.extend(CR[time:time + 60]) PRinLowP.extend(PR[time:time + 60]) #DatainLowP[time:time+60] = data[time:time+60] #PredinLowP[day*60*24+time:day*60*24+time+60] = predict[time:time+60] for minu in range(60): x.append(str(i) + "-" + str((Hours[day])[h]) + ":" + str(minu)) h += 1 plt.plot(np.arange(len(CRinLowP)), CRinLowP, "m-") plt.plot(np.arange(len(PRinLowP)), PRinLowP, "g*") #plt.plot(x,DatainLowP) #plt.plot(x,PredinLowP) plt.legend(["CR", "PR"]) plt.grid(True) plt.title( "changement rate of workloads and prediction precision within low Pearson" ) return PredinLowP '''
def analyzePandR(): filePart0 = [ "F:\\one\\predict\\GM/wc", "F:\\one\\final\\inmin/workload", "F:\\one\\final\inmin\\knots/workload" ] wrFile = WRFile() filePart1 = [".xlsx", "inmin.xlsx", "inmin_knots.xlsx"] p_coefficient = [] for i in range(53, 61): predict = wrFile.readDataFromExcel(filePath=filePart0[0] + str(i) + filePart1[0]) #result = TestGreyModel(periods = 4 ,filePath = filePart0[2]+str(i)+filePart1[2]) data = wrFile.readDataFromExcel(filePath=filePart0[1] + str(i) + filePart1[1]) print("day ", i) p_coefficient.extend(analyzeChangeRateAndPrecition(data, predict))
def anaylzeDelayDistribution(): wrFile = WRFile() #process_type = "SQ" filePath_head = "D:\\cloudsim\\log\\"+process_type+"_q"+"/"+process_type+"_q" QL_delay_result =[] for QL in [55,60,66,70,75]:#以文件为单位进行分析 delay_result = np.zeros(6) filePath = filePath_head+str(QL)+"/Cloudlet/"+process_type+"53cloudlet.xlsx" print(filePath) delay = wrFile.readDataFromExcel(filePath = filePath,sheet_name = "sheet",min_cols = 9,max_cols = 9) for element in delay: #分析每个请求的延迟情况 if element==-1: continue elif element<=0.11: delay_result[0]+=1 elif element<=0.22: delay_result[1]+=1 elif element<=0.33: delay_result[2]+=1 elif element<=0.44: delay_result[3]+=1 elif element<=0.55: delay_result[4]+=1 else: delay_result[5]+=1 delay_result[0] = round(1.0*delay_result[0]/len(delay),3) delay_result[1] = round(1.0*delay_result[1]/len(delay),3) delay_result[2] = round(1.0*delay_result[2]/len(delay),3) delay_result[3] = round(1.0*delay_result[3]/len(delay),3) delay_result[4] = round(1.0*delay_result[4]/len(delay),3) delay_result[5] = round(1.0*delay_result[5]/len(delay),3) delay_result = delay_result.tolist() QL_delay_result.append(delay_result) return QL_delay_result
def caculateSumOfSeperateDelay(filePath, cols): wrFile = WRFile() data = np.array( wrFile.readDataFromExcel(filePath=filePath, min_cols=cols, max_cols=cols)) data_sum = np.sum(data) return data_sum
def __init__(self): filePath = "F:/test/workload.xlsx" wrFile = WRFile() self.workload = wrFile.readDataFromExcel(filePath=filePath, sheet_name="1") data = self.evaluateBurst() data = data / np.max(data) wrFile.writeDataIntoExcel(data=data, filePath="F:/test/avgsampEn.xlsx")
def analyzeCompareResult(q): wrFile = WRFile() #fileKind = "F:\\data\\experiment/Delay_SQ_q" fileKind = "F:\\data\\experiment/Delay_q" x = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=1, max_cols=1) y = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=2, max_cols=2) z = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=3, max_cols=3) a = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=5, max_cols=5) #plot4DSeperate(x,y,z,a,q) PlotData().plot4D(x, y, z, a, q)
def analyzePredictionPrecision(): objFileName = "svr_rbf" precision = []# 列表头分别为 ratio,max,mean wrFile = WRFile() objFilePath = "F:\\FIFA\\predict\\"+objFileName+"/precision_over.xlsx" predict = wrFile.readDataFromExcel(objFilePath,min_cols = 1,max_cols = 3) predict = predict.reshape(3,8) result = [np.average(predict[0]),np.average(predict[1]),np.average(predict[2])] wrFile.writeDataIntoExcel(data = result,filePath = "F:\\FIFA\\predict\\"+objFileName+"/precision_over_evaluate.xlsx" )
def useCubicSplineFitData(): #读取数据 wrFile = WRFile() filePath = "F:/one/final/spline/workload51inmin_knots.xlsx" yaxis = np.array(wrFile.readDataFromExcel(filePath)) period = 5 #使用cubic spline进行拟合 data_volume = len(yaxis) xaxis = np.arange(0,data_volume,1)*period s = UnivariateSpline(x = xaxis,y = yaxis) #使用spline的拟合结果对每分钟的并发量进行预测,并获取残差 y = wrFile.readDataFromExcel(filePath = "F:/one/final/inmin/workload51inmin.xlsx") xnew = np.arange(0,len(y),1) ynew = s(xnew) residual = ynew-y plt.plot(xnew,residual)
def plotData(method): wrFile = WRFile() data_filePath = "F:\\FIFA\\predict\\traindata/day53_60inmin.xlsx" data = wrFile.readDataFromExcel(filePath = data_filePath) predict_filePath = "F:\\FIFA\\predict\\"+method+"/wc53_60.xlsx" if method=="lr": method = "LinearRegression" elif method=="gbdt": method = "Gradient Boosting Decision Tree" elif method=="svr_lr": method = "Support Vector Regression-linear" elif method=="svr_rbf": method = "Support Vector Regression-rbf" predict = np.floor(np.array(wrFile.readDataFromExcel(filePath = predict_filePath))) plt.plot(np.arange(len(data)),data,"m",LineWidth=2) plt.plot(np.arange(len(predict)),predict,"g",LineWidth=2) plt.title("prediction results of "+method,fontsize = 20) plt.xlabel("time(minute)",fontsize= 18) plt.ylabel("workload(times)",fontsize=18) plt.legend(["real","predict"],loc = "upper left",fontsize=18)
def TestGreyModel(periods, filePath): grey = GreyForecastModel() wrFile = WRFile() data = wrFile.readDataFromExcel(filePath=filePath) predict = [] predict[0:periods - 1] = data[0:periods - 1] for i in range(periods - 1, len(data)): #we set n as 4 x = data[i - (periods - 1):i + 1] #print(x) predict.append(grey.predictValue(x)) return [data, predict]
def divideSpace(q): #以数据为中心,然后把每个点定位到一个立方体中。立方体用一个三维数组表示。 better = np.zeros(q**3).reshape(q, q, q) worse = np.zeros(q**3).reshape(q, q, q) equal = np.zeros(q**3).reshape(q, q, q) wrFile = WRFile() #用正方体左下角的点代替整个正方体 fileKind = "F:\\data\\experiment/Delay_q" #fileKind = "F:\\data\\experiment/Delay_q" x = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=1, max_cols=1) y = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=2, max_cols=2) z = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=3, max_cols=3) a = wrFile.readDataFromExcel(filePath=fileKind + str(q) + ".xlsx", min_cols=5, max_cols=5) for i in range(len(x)): c = [x[i], y[i], z[i]] c = moveDown(c) result = a[i] if result == 0: equal[c[0]][c[1]][c[2]] += 1 elif result == 1: better[c[0]][c[1]][c[2]] += 1 else: worse[c[0]][c[1]][c[2]] += 1 #print("better is",better) #print("worse is",worse) #print("equal is",equal) analyzeResult(q, better, worse)
def analyzePrecision(): fileList = ["RGM/","FGM/","FFGM/","GM/","MGM/","MRGM/"] part0 = "F:\\one\\predict\\" part1 = ".xlsx" part2 = "F:\\one\\predict\\traindata/workload" part3 = "inmin.xlsx" wrFile = WRFile() k = 0 title = ["MAE","EVS"] rows = 9 cols = 3 while k<6: result = [] for day in range(53,61): data = wrFile.readDataFromExcel(filePath = part2+str(day)+part3) predict = wrFile.readDataFromExcel(filePath = part0+fileList[k]+"wc"+str(day)+part1) MAE = mean_absolute_error(y_true = data, y_pred = predict) EVS =explained_variance_score(y_true = data, y_pred = predict) result.append({"MAE":MAE,"EVS":EVS}) wrFile.writeDictIntoTable(data = result,filePath= part0+fileList[k]+"precision.docx" ,title = title ,cols = cols,rows = rows) k+=1
def analyzeStats(): qList = [2, 3, 4, 5, 6] wrFile = WRFile() result = [] for q in qList: fileName = "F:\data\experiment/Delay_SQ_q" + str(q) + ".xlsx" data = wrFile.readDataFromExcel(filePath=fileName, sheet_name="1", min_cols=4, max_cols=4) r = getStatisticAttribute(data) result.append(r) #print("ATBM is",result) wrFile.writeDataIntoExcel( result, filePath="F:\data\experiment/Delay_SQ_stats.xlsx")
def splitOnlineData(): shopName = ["京东商城", "天猫商城", "亚马逊商城", "淘宝商城"] #读出所有数据,然后都存放到 # 1.生成日期数据 wrFile = WRFile() data = wrFile.readDataFromExcel(filePath="F:\\data\\orginal\\online.xlsx", sheet_name="online", cols=3) #2. 对数据进行切片 jingdong = [] tmall = [] amazon = [] taobao = [] for i in range(len(data)): count = i % 4 if count == 0: if data[i] > 0: jingdong.append(data[i]) else: jingdong.append(data[i - 4]) elif count == 1: if data[i] > 0: tmall.append(data[i]) else: tmall.append(data[i - 4]) elif count == 2: if data[i] > 0: amazon.append(data[i]) else: amazon.append(data[i - 4]) elif count == 3: if data[i] > 0: taobao.append(data[i]) else: taobao.append(data[i - 4]) #3.将数据写入excel fileRoot = "F:\\data\\online/" filesuffix = ".xlsx" wrFile.writeDataIntoExcel(data=jingdong, filePath=fileRoot + "jingdong" + filesuffix) wrFile.writeDataIntoExcel(data=tmall, filePath=fileRoot + "tmall" + filesuffix) wrFile.writeDataIntoExcel(data=amazon, filePath=fileRoot + "amazon" + filesuffix) wrFile.writeDataIntoExcel(data=taobao, filePath=fileRoot + "taobao" + filesuffix)
def testGM(): wrFile = WRFile() part0 = "F:\\one\\predict\\traindata/workload" part1 = "inmin.xlsx" data = wrFile.readDataFromExcel(filePath=part0 + str(53) + part1, cols=1) data_start = 1020 data_end = 1050 burst = [ 62521, 62039, 61101, 66726, 64129, 61820, 63928, 63368, 61212, 60820, 59900, 62070, 62238, 61918, 61982, 64066, 65818, 63337, 65027, 64501, 68320, 80460, 63368, 61212, 60820, 59900, 62070, 62521, 62039, 61101, 66726 ] x = np.arange(0, len(burst)) #使用GM进行预测 periods = 5 GM = ModifiedGreyForecastModel(periods=periods) start = data_start pre_list = [] start = 1 for i in range(periods, len(burst)): x_0 = burst[start:i] pre = GM.predictGMValue(x_0) pre_list.append(pre) start += 1 plt.plot(x, burst, "b-*") plt.plot(np.arange(periods, periods + len(pre_list)), pre_list, "r-*") plt.legend(["real", "predict"]) plt.xlabel("time in minutes") plt.ylabel("workloads") plt.title("Prediction With GM")
c = moveDown(c) result = a[i] if result == 0: equal[c[0]][c[1]][c[2]] += 1 elif result == 1: better[c[0]][c[1]][c[2]] += 1 else: worse[c[0]][c[1]][c[2]] += 1 #print("better is",better) #print("worse is",worse) #print("equal is",equal) analyzeResult(q, better, worse) #divideSpace(q) #getStatisticAttribute(q) #analyzeStats() wrFile = WRFile() data = wrFile.readDataFromExcel( filePath="D:\\cloudsim\\log\\workload1/taobao.xlsx", min_cols=1, max_cols=1, sheet_name="1") data = np.floor((np.array(data) / 100)) #print(data) wrFile.writeDataIntoExcel( data=data, filePath="D:\\cloudsim\\log\\workload1/deplete_taobao.xlsx") print(np.percentile(np.array(data), 80))
def analyzeReadData(): filePath = "F:/test/workload63_69.xlsx" wrFile = WRFile() wrFile.readDataFromExcel(filePath=filePath, sheet_name="1")
def test(q): wrFile = WRFile() ATBM_file = "F:\data\experiment/Seperate_Delay_ATBM_q" + str(q) + ".xlsx" SQ_file = "F:\data\experiment/Seperate_Delay_SQ_q" + str(q) + ".xlsx" '''atbm = wrFile.readDataFromExcel2(filePath = ATBM_file) sq = wrFile.readDataFromExcel2(filePath = SQ_file) for i in range(len(atbm)): atbm_data = atbm[i] sq_data = sq[i] print(atbm_data) print(sq_data) print(np.sum(atbm_data[3:])-np.sum(sq_data[3:])) if np.sum(atbm_data[3:])!= np.sum(sq_data[3:]): print(atbm_data[:3]) ''' wrFile = WRFile() taobao = wrFile.readDataFromExcel( filePath="D:\\cloudsim\\log\\workload1/taobao.xlsx") FIFA = wrFile.readDataFromExcel( filePath="F:\\FIFA\\predict\\traindata\\inmin/workload53inmin.xlsx") plt.plot(np.arange(len(FIFA)), FIFA, "k") plt.legend([u'并发量'], fontsize=18, loc="upper left") plt.xlabel(u"时间/分钟", fontsize=18) plt.ylabel(u"并发量/次", fontsize=18) plt.grid(True) plt.title(u"1998年世界杯期间5月17日的用户并发量数据") #plotDelayDistribution(q) #q = 6 #plotDelayDistribution(q)
def compareModel(): fileStart = "F:\\one\\final\\inmin/workload" fileEnd = "inmin.xlsx" wrFile = WRFile() #fft = FFTPredict() #noBurst_pre = fft.FFTofNoBurst(data51 , data52 ) #WFD_pre = fft.FFTofWFD(data51 , data52 ) periods = 10 for i in range(53, 61): result = TestGreyModel(periods, filePath=fileStart + str(i) + fileEnd) predict = result[1] print(i) wrFile.writeDataIntoExcel(data=predict, filePath="F:/one/predict/GM/wc" + str(i) + ".xlsx") #compareModel() wrFile = WRFile() #predict = wrFile.readDataFromExcel("F:\\one\\predict\\GM/wc53_60.xlsx") data = wrFile.readDataFromExcel( "F:\\one\\predict\\traindata/workload54inmin.xlsx") predict = wrFile.readDataFromExcel("F:\\one\\predict\\GM/wc54.xlsx") plt.plot(np.arange(len(data)), data) plt.plot(np.arange(len(predict)), predict) plt.legend(["r-w", "p-w"]) plt.title("prediction result for day 54 by GM ")
def getData(self,filePath): wrFile = WRFile() data = wrFile.readDataFromExcel(filePath,cols=1) return data
amazon.append(data[i - 4]) elif count == 3: if data[i] > 0: taobao.append(data[i]) else: taobao.append(data[i - 4]) #3.将数据写入excel fileRoot = "F:\\data\\online/" filesuffix = ".xlsx" wrFile.writeDataIntoExcel(data=jingdong, filePath=fileRoot + "jingdong" + filesuffix) wrFile.writeDataIntoExcel(data=tmall, filePath=fileRoot + "tmall" + filesuffix) wrFile.writeDataIntoExcel(data=amazon, filePath=fileRoot + "amazon" + filesuffix) wrFile.writeDataIntoExcel(data=taobao, filePath=fileRoot + "taobao" + filesuffix) wrFile = WRFile() fileName = "taobao" data = wrFile.readDataFromExcel(filePath="F:\\data\\online/" + fileName + ".xlsx", sheet_name="Sheet1", cols=2) pre = wrFile.readDataFromExcel(filePath="F:\\data\\online\\predict/exp.xlsx", sheet_name="Sheet1", cols=3) plt.plot(np.arange(len(data)), data) plt.plot(np.arange(len(pre)), pre) plt.legend(["r", "p"])
self._delayTime = np.copy(self.time) for i in range(0,self.windows): temp_requests+=self.workload[i] temp = (temp_requests-self.c0)/r-(self.time[i]-self.t0) if temp<0: temp = 0 self._delayTime[i] += temp def GiveQComputRB(self,q): pass #*************创建测试数据集******************** wrFile = WRFile() filePath = "F:/result.xlsx" cols = 1 data = wrFile.readDataFromExcel(filePath,cols,sheet_name = 2) #data[6] = 200 time = np.arange(0,len(data)) result = np.vstack([data,time]) r = 400 b = 450 print("r is ",r,"b is" ,b) #*************测试请求切分效果*********************** lager = LagerRequest(result,r =r) q = 50 #请求达到后,队列的存储情况 rrange = lager.computeRRange() sample = np.linspace(rrange[0],rrange[1],2) b_result = []
delay_result[4]+=1 else: delay_result[5]+=1 delay_result[0] = round(1.0*delay_result[0]/len(delay),3) delay_result[1] = round(1.0*delay_result[1]/len(delay),3) delay_result[2] = round(1.0*delay_result[2]/len(delay),3) delay_result[3] = round(1.0*delay_result[3]/len(delay),3) delay_result[4] = round(1.0*delay_result[4]/len(delay),3) delay_result[5] = round(1.0*delay_result[5]/len(delay),3) delay_result = delay_result.tolist() QL_delay_result.append(delay_result) return QL_delay_result '''wrFile = WRFile() process_type = "ATBM" data = anaylzeDelayDistribution() wrFile.writeDataIntoExcel(data = data,filePath ="D:\\cloudsim\\log\\"+process_type+"_q"+"/"+process_type+"_delay_distribution.xlsx" ) ''' wrFile = WRFile() predict_type="lr" data = wrFile.readDataFromExcel(filePath="F:\\FIFA\\final\\inmin/workload53_60inmin.xlsx") predict = wrFile.readDataFromExcel(filePath="F:\\FIFA\\predict\\"+predict_type+"/wc53_60.xlsx") plt.plot(np.arange(len(data)),data,"k") plt.plot(np.arange(len(data)),predict,"wo") plt.legend(["real","predict"],fontsize=16,loc="upper left") plt.title("prediction results of "+predict_type,fontsize=20) plt.xlabel("time(minute)",fontsize=18) plt.xticks(fontsize = 16) plt.ylabel("workloads",fontsize=18) plt.yticks(fontsize = 16) plt.savefig("E:\\"+ u"日常工作"+"\\"+u"下一代计算机技术"+"\\"+u"重要照片"+"\\"+u"各类算法的预测结果"+"/"+predict_type+".jpeg")
def testReadData(): wrFile = WRFile() data = wrFile.readDataFromExcel(filePath="F:/test/workload.xlsx") data = np.array(data)
@author: User """ import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("D:/anaconda/project/utils") from utils import WRFile from scipy.stats.stats import pearsonr import scipy.fftpack as fft import pandas as pd '''设置初始的数据值''' fileStart = "F:\\one\\final\\inmin/knots/workload" fileEnd = "inmin_knots.xlsx" wrFile = WRFile() data51 = wrFile.readDataFromExcel(filePath=fileStart + "51" + fileEnd) data52 = wrFile.readDataFromExcel(filePath=fileStart + "52" + fileEnd) data53 = wrFile.readDataFromExcel(filePath=fileStart + "53" + fileEnd) data54 = wrFile.readDataFromExcel(filePath=fileStart + "54" + fileEnd) data_volume = len(data51) x = np.arange(0, data_volume) def useAverage(dataA=data51, dataB=data52, dataC=data53): predict = (dataA + dataB) / 2 #plt.plot(x,predict) #plt.plot(x,dataC) #plt.legend(["p_w","r_w"]) #plt.title("use average of dataA and dataB") presicion = pearsonr(predict.real, dataC) return [predict, presicion]
def inc_dec(self, begin, slope, fluctuation, amount): middle = amount / 2 data0 = begin + slope * np.arange(middle) data1 = np.max(data0) - slope * np.arange(middle, amount) data = np.append(data0, data1) + np.random.randint( -1 * fluctuation, fluctuation + 1, amount) return data def dec_inc(self, begin, slope, fluctuation, amount): middle = amount / 2 data0 = begin - slope * np.arange(middle) data1 = np.min(data0) + slope * np.arange(middle, amount) data = np.append(data0, data1) + np.random.randint( -1 * fluctuation, fluctuation + 1, amount) return data wrFile = WRFile() file_List = [ "stationary", "inc", "dec", "flat_dec", "flat_inc", "inc_dec", "dec_inc" ] data = wrFile.readDataFromExcel( filePath="D:\\cloudsim\\log\\workload1/synthetic/" + file_List[0] + ".xlsx") plt.plot(np.arange(len(data)), data, "k") plt.title(u"平稳型并发量数据") plt.xlabel(u"时间", fontsize=18) plt.ylabel(u"并发量数量", fontsize=18) plt.ylim(0, 60) plt.legend(["并发量"], loc='upper left')
def __init__(self, filePath): wrFile = WRFile() self.data = numpy.array( wrFile.readDataFromExcel(filePath=filePath, cols=1))
# -*- coding: utf-8 -*- """ Created on Wed Oct 26 11:22:48 2016 @author: User """ import matplotlib.pyplot as plt from utils import WRFile wrFile = WRFile() filePath = "F:/lab/source/data/library/1.xlsx" cols = 1 original_data = wrFile.readDataFromExcel(filePath=filePath, cols=cols, sheet_name="1") print(original_data) #把数据以100为单位进行切分 '''segement = -1 segement_data = [] for i in range(len(original_data)): if i%500==0: segement = segement+1 if(segement!=1): wrFile.writeDataIntoExcel(data = segement_data,filePath = filePath,cols = segement,sheet_index = 1) segement_data.clear() print(segement) segement_data.append(original_data[i]) '''