当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.apply方法代码示例

本文整理汇总了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
开发者ID:T-002,项目名称:pycast,代码行数:20,代码来源:methodtest.py

示例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
开发者ID:fleupold,项目名称:pycast,代码行数:45,代码来源:timeseriesmiscellaneoustest.py


注:本文中的pycast.common.timeseries.TimeSeries.apply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。