Anonymous Anonymous - 2 months ago
141 0

No description

Python

codestuf

new = []
    for i in buses:
#         j = j+1
#         if j > 2:
#             break
#         print "hello1"
        start = 0
        prevE = -1
        for k in range(len(buses[i])):
            #print buses[i][k].pdist
            if buses[i][k].pdist < prevE:
                # print "hello2"
                tempPArr = buses[i][start:k] #partition by pdist

                newData = pd.DataFrame(tempPArr)
                
                newData.set_index('tmstmp')
                new.append(newData) #add to new array
                start = k #new start           
            prevE = buses[i][k].pdist
        #print "hello3"
        tempPArr = buses[i][start:len(buses[i])]
        newData = pd.DataFrame(tempPArr)
        newData.set_index('tmstmp')
        new.append(newData) #add to new array
#             print k.vid, k.pid, k.rt, k.des
            # print k.pdist
Comments