本文整理汇总了Python中toolz.join函数的典型用法代码示例。如果您正苦于以下问题:Python join函数的具体用法?Python join怎么用?Python join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_join
def test_join(transform):
other = transform([1, 2, 3])
c = b.join(other, on_self=isodd, on_other=iseven)
assert_eq(c, list(join(iseven, [1, 2, 3], isodd, list(b))))
assert_eq(b.join(other, isodd),
list(join(isodd, [1, 2, 3], isodd, list(b))))
assert c.name == b.join(other, on_self=isodd, on_other=iseven).name
开发者ID:togar-nk,项目名称:dask,代码行数:7,代码来源:test_bag.py
示例2: compute_up
def compute_up(t, lhs, rhs, **kwargs):
""" Join Operation for Python Streaming Backend
Note that a pure streaming Join is challenging/impossible because any row
in one seq might connect to any row in the other, requiring simultaneous
complete access.
As a result this approach compromises and fully realizes the LEFT sequence
while allowing the RIGHT sequence to stream. As a result
Always put your bigger collection on the RIGHT side of the Join.
"""
if lhs == rhs:
lhs, rhs = itertools.tee(lhs, 2)
on_left = [t.lhs.fields.index(col) for col in listpack(t.on_left)]
on_right = [t.rhs.fields.index(col) for col in listpack(t.on_right)]
left_default = (None if t.how in ('right', 'outer')
else toolz.itertoolz.no_default)
right_default = (None if t.how in ('left', 'outer')
else toolz.itertoolz.no_default)
pairs = toolz.join(on_left, lhs,
on_right, rhs,
left_default=left_default,
right_default=right_default)
assemble = pair_assemble(t)
return map(assemble, pairs)
开发者ID:jcrist,项目名称:blaze,代码行数:31,代码来源:python.py
示例3: generate2
def generate2(buckets1, buckets2):
for x, y in join(first, generate1(buckets1), first, generate1(buckets2),
left_default=None, right_default=None):
if x is None:
yield y[0], 0, y[1]
elif y is None:
yield x[0], x[1], 0
else:
yield x[0], x[1], y[1]
开发者ID:NLeSC,项目名称:AVResearcherXL,代码行数:9,代码来源:views.py
示例4: test_join
def test_join():
assert list(b.join([1, 2, 3], on_self=isodd, on_other=iseven)) == \
list(join(iseven, [1, 2, 3], isodd, list(b)))
assert list(b.join([1, 2, 3], isodd)) == \
list(join(isodd, [1, 2, 3], isodd, list(b)))
开发者ID:BabeNovelty,项目名称:dask,代码行数:5,代码来源:test_bag.py
示例5: test_join
def test_join():
c = b.join([1, 2, 3], on_self=isodd, on_other=iseven)
assert list(c) == list(join(iseven, [1, 2, 3], isodd, list(b)))
assert list(b.join([1, 2, 3], isodd)) == \
list(join(isodd, [1, 2, 3], isodd, list(b)))
assert c.name == b.join([1, 2, 3], on_self=isodd, on_other=iseven).name
开发者ID:rla3rd,项目名称:dask,代码行数:6,代码来源:test_bag.py
注:本文中的toolz.join函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论