0
我有一个时间戳在H:M:S中,并且正在通过strptime处理来创建一个时间数组。我从23:59:59到0:0:0出现问题。当我去绘制这条线时,线条一直跳回到图形上。有没有一种方法可以在不知道一天的情况下处理?即我只有在H:M:S的时候才会被给予,我试图不遍历整个数组来找到这种情况。Matplotlib strptime与日翻转
我有一个时间戳在H:M:S中,并且正在通过strptime处理来创建一个时间数组。我从23:59:59到0:0:0出现问题。当我去绘制这条线时,线条一直跳回到图形上。有没有一种方法可以在不知道一天的情况下处理?即我只有在H:M:S的时候才会被给予,我试图不遍历整个数组来找到这种情况。Matplotlib strptime与日翻转
尝试增加了一天的参数在一个循环:
import time
import matplotlib.pyplot as plt
dayn = 0
while True:
t = raw_input()
h,m,s = t[:1],t[3:5],t[6:]
t_strc = time.strptime(str(dayn)+':'+t,'%d:%H:%M:%S')
if int(h+m+s)>235958:
dayn += 1
r = time2num(t_strc) # a function read tm_mday and other values to give increasing number
plt.plot(x,r) # x is your data , r is time
plt.show()
其中time2num是把时间结构(有天)的函数成数字值
你的意思是你刚才跳到另一个一天它必须增加不返回的时间值。 –