本文整理汇总了Python中blaze.expr.TableSymbol.nunique方法的典型用法代码示例。如果您正苦于以下问题:Python TableSymbol.nunique方法的具体用法?Python TableSymbol.nunique怎么用?Python TableSymbol.nunique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blaze.expr.TableSymbol
的用法示例。
在下文中一共展示了TableSymbol.nunique方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reduction
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import nunique [as 别名]
def test_reduction():
t = TableSymbol("t", "{name: string, amount: int32}")
r = sum(t["amount"])
assert r.dshape in (dshape("int64"), dshape("{amount: int64}"), dshape("{amount_sum: int64}"))
assert "amount" not in str(t.count().dshape)
assert t.count().dshape[0] in (int32, int64)
assert "int" in str(t.count().dshape)
assert "int" in str(t.nunique().dshape)
assert "string" in str(t["name"].max().dshape)
assert "string" in str(t["name"].min().dshape)
assert "string" not in str(t.count().dshape)
t = TableSymbol("t", "{name: string, amount: real, id: int}")
assert "int" in str(t["id"].sum().dshape)
assert "int" not in str(t["amount"].sum().dshape)
示例2: test_reduction
# 需要导入模块: from blaze.expr import TableSymbol [as 别名]
# 或者: from blaze.expr.TableSymbol import nunique [as 别名]
def test_reduction():
t = TableSymbol('t', '{name: string, amount: int32}')
r = sum(t['amount'])
assert r.dshape in (dshape('int64'),
dshape('{amount: int64}'),
dshape('{amount_sum: int64}'))
assert 'amount' not in str(t.count().dshape)
assert t.count().dshape[0] in (int32, int64)
assert 'int' in str(t.count().dshape)
assert 'int' in str(t.nunique().dshape)
assert 'string' in str(t['name'].max().dshape)
assert 'string' in str(t['name'].min().dshape)
assert 'string' not in str(t.count().dshape)
t = TableSymbol('t', '{name: string, amount: real, id: int}')
assert 'int' in str(t['id'].sum().dshape)
assert 'int' not in str(t['amount'].sum().dshape)