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