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


Python StreamHist.merge方法代码示例

本文整理汇总了Python中streamhist.StreamHist.merge方法的典型用法代码示例。如果您正苦于以下问题:Python StreamHist.merge方法的具体用法?Python StreamHist.merge怎么用?Python StreamHist.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在streamhist.StreamHist的用法示例。


在下文中一共展示了StreamHist.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_missing_merge

# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import merge [as 别名]
def test_missing_merge():
    h1 = StreamHist(maxbins=8).update(None)
    h2 = StreamHist(maxbins=8)
    assert h1.merge(h2) is not None

    h1 = StreamHist().update(None)
    h2 = StreamHist().update(None)
    merged = StreamHist().merge(h1.merge(h2))

    assert merged.missing_count == 2
开发者ID:carsonfarmer,项目名称:streamhist,代码行数:12,代码来源:test_histogram.py

示例2: test_merge

# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import merge [as 别名]
def test_merge():
    assert len(StreamHist().merge(StreamHist()).bins) == 0
    assert len(StreamHist().merge(StreamHist().update(1)).bins) == 1
    assert len(StreamHist().update(1).merge(StreamHist()).bins) == 1

    points = 1000
    count = 10
    hists = []
    for c in range(count):
        h = StreamHist()
        for p in make_normal(points):
            h.update(p)
        hists.append(h)
    merged = reduce(lambda a, b: a.merge(b), hists)
    assert about(merged.sum(0), (points*count)/2.0, (points*count)/50.0)

    h1 = StreamHist().update(1).update(None)
    h2 = StreamHist().update(2).update(None)
    merged = h1.merge(h2)
    assert merged.total == 2
开发者ID:carsonfarmer,项目名称:streamhist,代码行数:22,代码来源:test_histogram.py

示例3: test_min_max

# 需要导入模块: from streamhist import StreamHist [as 别名]
# 或者: from streamhist.StreamHist import merge [as 别名]
def test_min_max():
    h = StreamHist()
    assert h.min() is None
    assert h.max() is None

    for _ in range(1000):
        h.update(rand_int(10))

    assert h.min() == 0
    assert h.max() == 10

    h1 = StreamHist()
    h2 = StreamHist()
    for p in range(4):
        h1.update(p)
        h2.update(p+2)
    merged = h1.merge(h2)

    assert merged.min() == 0
    assert merged.max() == 5
开发者ID:carsonfarmer,项目名称:streamhist,代码行数:22,代码来源:test_histogram.py


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