def _create_list_zerofill(self, data, start,stop):
next = self._to_timestamp(start)/10*10+10
stop = self._to_timestamp(stop)/10*10-180
now = 0
prev = 0
prev_t = next
for i in data:
# now = self._to_timestamp(i.timestamp)
# while now > next:
# w = 1.*(now - next)/(now - prev_t)
# yield {
# "time": datetime.utcfromtimestamp(next).isoformat()+'.000Z',
# "count": int(prev * w + i.frequency * (1-w)),
# }
# next += 10
yield {
"time": i.timestamp.isoformat()+'.000Z',
"count": int(i.frequency),
}
prev = i.frequency
prev_t = now
next = now+10
# while next < stop:
# yield {
# "time": datetime.utcfromtimestamp(next).isoformat()+'.000Z',
# "count": 0,
# }
# next += 10
评论列表
文章目录