本文整理汇总了Python中pycast.common.timeseries.TimeSeries.apply方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.apply方法的具体用法?Python TimeSeries.apply怎么用?Python TimeSeries.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycast.common.timeseries.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.apply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_value_error_test
# 需要导入模块: from pycast.common.timeseries import TimeSeries [as 别名]
# 或者: from pycast.common.timeseries.TimeSeries import apply [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:
tsOne.apply(sma)
except ValueError:
pass
else:
assert False # pragma: no cover
示例2: method_test
# 需要导入模块: from pycast.common.timeseries import TimeSeries [as 别名]
# 或者: from pycast.common.timeseries.TimeSeries import apply [as 别名]
def method_test(self):
"""Test if TimeSeries apply branches work correctly.
This is mainly to increase code coverage."""
mOne = BaseMethod([], hasToBeSorted=True, hasToBeNormalized=True)
mTwo = BaseMethod([], hasToBeSorted=False, hasToBeNormalized=True)
mThree = BaseMethod([], hasToBeSorted=True, hasToBeNormalized=False)
mFour = BaseMethod([], hasToBeSorted=False, hasToBeNormalized=False)
ts = TimeSeries(isNormalized=True)
ts.add_entry(0.0, 0.0)
ts.add_entry(0.1, 0.1)
ts.add_entry(0.2, 0.2)
ts.add_entry(0.3, 0.3)
ts.add_entry(0.4, 0.4)
try:
ts.apply(mOne)
except NotImplementedError:
pass
else:
assert False # pragma: no cover
try:
ts.apply(mTwo)
except NotImplementedError:
pass
else:
assert False # pragma: no cover
try:
ts.apply(mThree)
except NotImplementedError:
pass
else:
assert False # pragma: no cover
try:
ts.apply(mFour)
except NotImplementedError:
pass
else:
assert False # pragma: no cover