當前位置: 首頁>>代碼示例>>Python>>正文


Python Symbol.sort方法代碼示例

本文整理匯總了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'
開發者ID:EGQM,項目名稱:blaze,代碼行數:11,代碼來源:test_symbol.py

示例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)
開發者ID:EGQM,項目名稱:blaze,代碼行數:14,代碼來源:test_symbol.py

示例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]]])
開發者ID:EGQM,項目名稱:blaze,代碼行數:6,代碼來源:test_symbol.py

示例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],
開發者ID:luccasmenezes,項目名稱:blaze,代碼行數:33,代碼來源:test_comprehensive.py


注:本文中的blaze.expr.Symbol.sort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。