sum#
- bamengine.ops.sum(a, axis=None, where=None)[source]#
Sum array elements, optionally over axis or subset.
- Parameters:
- Returns:
Sum of array elements (scalar if axis=None, array otherwise).
- Return type:
Examples
>>> import bamengine.ops as ops >>> production = np.array([10, 20, 30, 0]) >>> # Total production >>> total = ops.sum(production) >>> # total: 60 >>> >>> # Production only from active firms >>> active = production > 0 >>> active_total = ops.sum(production, where=active) >>> # active_total: 60