本文整理汇总了Python中blaze.expr.TableSymbol.relabel方法的典型用法代码示例。如果您正苦于以下问题:Python TableSymbol.relabel方法的具体用法?Python TableSymbol.relabel怎么用?Python TableSymbol.relabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blaze.expr.TableSymbol
的用法示例。
在下文中一共展示了TableSymbol.relabel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_relabel_join
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import relabel [as 别名]
def test_relabel_join():
names = TableSymbol('names', '{first: string, last: string}')
siblings = join(names.relabel({'last': 'left'}),
names.relabel({'last': 'right'}), 'first')
assert siblings.fields == ['first', 'left', 'right']
示例2: test_relabel_join
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import relabel [as 别名]
def test_relabel_join():
names = TableSymbol('names', '{first: string, last: string}')
siblings = join(names.relabel({'first': 'left'}),
names.relabel({'first': 'right'}),
'last')[['left', 'right']]
data = [('Alice', 'Smith'),
('Bob', 'Jones'),
('Charlie', 'Smith')]
print(set(compute(siblings, {names: data})))
assert ('Alice', 'Charlie') in set(compute(siblings, {names: data}))
assert ('Alice', 'Bob') not in set(compute(siblings, {names: data}))
示例3: test_relabel
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import relabel [as 别名]
def test_relabel():
t = TableSymbol('t', '{name: string, amount: int32, id: int32}')
rl = t.relabel({'name': 'NAME', 'id': 'ID'})
assert eval(str(rl)).isidentical(rl)
print(rl.columns)
assert rl.columns == ['NAME', 'amount', 'ID']
示例4: test_relabel
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import relabel [as 别名]
def test_relabel():
t = TableSymbol('t', '{name: string, amount: int32, id: int32}')
rl = t.relabel({'name': 'NAME', 'id': 'ID'})
rlc = t['amount'].relabel({'amount': 'BALANCE'})
assert eval(str(rl)).isidentical(rl)
print(rl.fields)
assert rl.fields == ['NAME', 'amount', 'ID']
assert not isscalar(rl.dshape.measure)
assert isscalar(rlc.dshape.measure)
示例5: test_relabel_join
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import relabel [as 别名]
def test_relabel_join():
names = TableSymbol("names", "{first: string, last: string}")
siblings = join(names.relabel({"last": "left"}), names.relabel({"last": "right"}), "first")
assert siblings.fields == ["first", "left", "right"]