本文整理汇总了Python中pycast.common.timeseries.TimeSeries.normalize方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.normalize方法的具体用法?Python TimeSeries.normalize怎么用?Python TimeSeries.normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycast.common.timeseries.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.normalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: energy_data
# 需要导入模块: from pycast.common.timeseries import TimeSeries [as 别名]
# 或者: from pycast.common.timeseries.TimeSeries import normalize [as 别名]
def energy_data(request):
"""
Connects to the database and loads Readings for device 8.
"""
cur = db.cursor().execute("""SELECT timestamp, current FROM Readings""")
original = TimeSeries()
original.initialize_from_sql_cursor(cur)
original.normalize("day", fusionMethod = "sum")
return Response(json.dumps(original, cls=PycastEncoder), content_type='application/json')
示例2: execute_value_error_test
# 需要导入模块: from pycast.common.timeseries import TimeSeries [as 别名]
# 或者: from pycast.common.timeseries.TimeSeries import normalize [as 别名]
def execute_value_error_test(self):
"""Test for the ValueError in SimpleMovingAverage.execute()."""
tsOne = TimeSeries()
data = [[1.5, 10.0],[2.5, 12.4],[3.5, 17.380000000000003],[4.5, 16.666],[5.5, 20.6662],[6.5, 23.46634],[7.5, 20.026438]]
tsTwo = TimeSeries.from_twodim_list(data)
sma = SimpleMovingAverage(3)
tsOne.normalize("second")
res = tsTwo.apply(sma)
try:
res = tsOne.apply(sma)
except ValueError:
pass
else:
assert False # pragma: no cover