本文整理匯總了Python中blaze.expr.Symbol.sum方法的典型用法代碼示例。如果您正苦於以下問題:Python Symbol.sum方法的具體用法?Python Symbol.sum怎麽用?Python Symbol.sum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類blaze.expr.Symbol
的用法示例。
在下文中一共展示了Symbol.sum方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_keepdims
# 需要導入模塊: from blaze.expr import Symbol [as 別名]
# 或者: from blaze.expr.Symbol import sum [as 別名]
def test_keepdims():
x = Symbol('x', '5 * 3 * float32')
assert x.sum(axis=0, keepdims=True).dshape == dshape('1 * 3 * float32')
assert x.sum(axis=1, keepdims=True).dshape == dshape('5 * 1 * float32')
assert x.sum(axis=(0, 1), keepdims=True).dshape == dshape('1 * 1 * float32')
assert x.std(axis=0, keepdims=True).shape == (1, 3)
示例2: test_reduction_dshape
# 需要導入模塊: from blaze.expr import Symbol [as 別名]
# 或者: from blaze.expr.Symbol import sum [as 別名]
def test_reduction_dshape():
x = Symbol('x', '5 * 3 * float32')
assert x.sum().dshape == x.schema
assert x.sum(axis=0).dshape == dshape('3 * float32')
assert x.sum(axis=1).dshape == dshape('5 * float32')
assert x.sum(axis=(0, 1)).dshape == dshape('float32')
示例3: test_axis_kwarg_is_normalized_to_tuple
# 需要導入模塊: from blaze.expr import Symbol [as 別名]
# 或者: from blaze.expr.Symbol import sum [as 別名]
def test_axis_kwarg_is_normalized_to_tuple():
x = Symbol('x', '5 * 3 * float32')
exprs = [x.sum(), x.sum(axis=1), x.sum(axis=[1]), x.std(), x.mean(axis=1)]
for expr in exprs:
assert isinstance(expr.axis, tuple)