本文整理汇总了Python中blaze.expr.Symbol.sort方法的典型用法代码示例。如果您正苦于以下问题:Python Symbol.sort方法的具体用法?Python Symbol.sort怎么用?Python Symbol.sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blaze.expr.Symbol
的用法示例。
在下文中一共展示了Symbol.sort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sort
# 需要导入模块: from blaze.expr import Symbol [as 别名]
# 或者: from blaze.expr.Symbol import sort [as 别名]
def test_sort():
t = Symbol('t', 'var * {name: string, amount: int32, id: int32}')
s = t.sort('amount', ascending=True)
print(str(s))
assert eval(str(s)).isidentical(s)
assert s.schema == t.schema
assert t['amount'].sort().key == 'amount'
示例2: test_length
# 需要导入模块: from blaze.expr import Symbol [as 别名]
# 或者: from blaze.expr.Symbol import sort [as 别名]
def test_length():
t = Symbol('t', '10 * {name: string, amount: int}')
s = Symbol('s', 'var * {name:string, amount:int}')
assert t.dshape == dshape('10 * {name: string, amount: int}')
assert len(t) == 10
assert len(t.name) == 10
assert len(t[['name']]) == 10
assert len(t.sort('name')) == 10
assert len(t.head(5)) == 5
assert len(t.head(50)) == 10
with pytest.raises(ValueError):
len(s)
示例3: test_improper_selection
# 需要导入模块: from blaze.expr import Symbol [as 别名]
# 或者: from blaze.expr.Symbol import sort [as 别名]
def test_improper_selection():
t = Symbol('t', 'var * {x: int, y: int, z: int}')
assert raises(Exception, lambda: t[t['x'] > 0][t.sort()[t['y' > 0]]])
示例4: sin
# 需要导入模块: from blaze.expr import Symbol [as 别名]
# 或者: from blaze.expr.Symbol import sort [as 别名]
mongo = None
# {expr: [list-of-exclusions]}
expressions = {
t: [],
t['id']: [],
t.id.max(): [],
t.amount.sum(): [],
t.amount.head(): [],
t.amount + 1: [mongo],
sin(t.amount): [sql, mongo], # sqlite doesn't support trig
exp(t.amount): [sql, mongo],
t.amount > 50: [mongo],
t[t.amount > 50]: [],
t.like(name='Alic*'): [],
t.sort('name'): [bc],
t.sort('name', ascending=False): [bc],
t.head(3): [],
t.name.distinct(): [],
t[t.amount > 50]['name']: [], # odd ordering issue
t.id.map(lambda x: x + 1, schema='int', name='id'): [sql, mongo],
t[t.amount > 50]['name']: [],
by(t.name, t.amount.sum()): [],
by(t.id, t.id.count()): [],
by(t[['id', 'amount']], t.id.count()): [],
by(t[['id', 'amount']], (t.amount + 1).sum()): [mongo],
by(t[['id', 'amount']], t.name.nunique()): [mongo],
by(t.id, t.amount.count()): [],
by(t.id, t.id.nunique()): [mongo],
# by(t, t.count()): [],
# by(t.id, t.count()): [df],