notifications = DeviceNotification.objects.all()
for n in notifications:
time_period = n.time_period
logs = DeviceLog.objects.all()[:time_period]
for l in logs:
print(l.celsius)
我想弄清楚如何发现返回的对象属性(让我们使用摄氏度)之间的温度“趋势”或“分布”
基本上,我想知道温度是上升了一定量,还是下降了一定量。。。例如:if celsius has increased by 2 degrees within the past 5 hours
我不确定这是否可以通过过滤器来完成,或者是否必须将每个celsius
值添加到数组中,并将数组与abs()
或类似的内容进行比较
遵循您的模式:
我把它改成:
你可以通过记录温度和时间来做到这一点
假设你有温度记录,你想知道温度是否在过去的5小时内升高
你可以得到现在和5小时前的温度值
现在,你可以这样做
if(log\u now.centices-log\u pass.centices)>;1: return“温度上升2摄氏度” 其他: return“温度不增加2摄氏度”
相关问题 更多 >
编程相关推荐