本文整理汇总了Python中pthelma.timeseries.Timeseries.average方法的典型用法代码示例。如果您正苦于以下问题:Python Timeseries.average方法的具体用法?Python Timeseries.average怎么用?Python Timeseries.average使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pthelma.timeseries.Timeseries
的用法示例。
在下文中一共展示了Timeseries.average方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from pthelma.timeseries import Timeseries [as 别名]
# 或者: from pthelma.timeseries.Timeseries import average [as 别名]
def process():
for household in Household.objects.all():
daily_series_db = household.timeseries.get(
time_step__id=TSTEP_DAILY)
series = TSeries(id=daily_series_db.id)
series.read_from_db(db.connection)
m = 1000.000*series.average()
if math.isnan(m):
continue
num_of_occupants = max(1,
int(round(m/AVERAGE_UNIT_WATER_CONSUMPTION)))
print 'Household with id=%s, average daily consumption %.1f, '\
'number of occupants set to %s'%(household.id, m,
num_of_occupants,)
household.num_of_occupants = num_of_occupants
household.save()