Applies a rolling sum operator to the stream.

        Attributes:
             sum_attribute_index (int): The index of the attribute to sum
             (assuming tuple records).
6951
def reduce(self, reduce_fn):
        
        op = Operator(
            _generate_uuid(),
            OpType.Reduce,
            "Sum",
            reduce_fn,
            num_instances=self.env.config.parallelism)
        return self.__register(op)
1003947
def total_transactions_by_subacct(self, subaccount):
        
        return sum(
            t.amount for t in self.transactions if t.subaccount == subaccount)
38337
def sum(self, callback=None):
        
        if callback is None:
            return sum(self.items)

        callback = self._value_retriever(callback)

        return self.reduce(lambda result, item: (result or 0) + callback(item))
1287922
def _update_count(self, index):
        
        if not isinstance(index, (list, tuple)):
            index = [index]
        for idx in index:
            if idx not in self._index_update_count:
                self._index_update_count[idx] = self.begin_num_update
            self._index_update_count[idx] += 1
            self.num_update = max(self._index_update_count[idx], self.num_update)
878243
def next(self, val):
        
        self.queue.append(val)
        return sum(self.queue) / len(self.queue)
369611
def getAttributeValueType(self, index):
        
        offset = self._get_attribute_offset(index)
        return self.m_attributes[offset + const.ATTRIBUTE_IX_VALUE_TYPE]
438760
function(index) {
        var sum = 0;

        $.each(this._sizes, function(i, value) {
            if (i < index) {
                sum += value.totalSize;
            }
        });

        return sum;
    }
430212
def reduce_sum(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'})
    return 'sum', new_attrs, inputs
1164361
def _cost_method(self, *args, **kwargs):
        

        return np.sum([operator.cost(data) for operator, data in
                       zip(self.operators, args[0])])
1261144
def sum(self, default=None):
        
        return numpy.asscalar(numpy.sum(self.values)) if self.values else default
984557
def weight_list_to_tuple(data, attr_name):
    '''
    
    '''

    if len(data['Value']) != len(data['Weight']):
        raise ValueError('Number of weights do not correspond to number of '
                         'attributes in %s' % attr_name)
    weight = np.array(data['Weight'])
    if fabs(np.sum(weight) - 1.) > 1E-7:
        raise ValueError('Weights do not sum to 1.0 in %s' % attr_name)

    data_tuple = []
    for iloc, value in enumerate(data['Value']):
        data_tuple.append((value, weight[iloc]))
    return data_tuple
1054472
def increment(self, attr, amount=1):
        
        return self.set(attr, operation.Increment(amount))
361798
def sum_(self, col: str) -> float:
        
        try:
            df = self.df[col]
            num = float(df.sum())
            return num
        except Exception as e:
            self.err(e, "Can not sum data on column " + str(col))
1250504
def getAttributeValueData(self, index):
        
        offset = self._get_attribute_offset(index)
        return self.m_attributes[offset + const.ATTRIBUTE_IX_VALUE_DATA]
1013435
def _end_apply_index(self, dtindex):
        
        off = dtindex.to_perioddelta('D')

        base, mult = libfrequencies.get_freq_code(self.freqstr)
        base_period = dtindex.to_period(base)
        if not isinstance(base_period._data, np.ndarray):
            # unwrap PeriodIndex --> PeriodArray
            base_period = base_period._data

        if self.n > 0:
            # when adding, dates on end roll to next
            normed = dtindex - off + Timedelta(1, 'D') - Timedelta(1, 'ns')
            roll = np.where(base_period.to_timestamp(how='end') == normed,
                            self.n, self.n - 1)
            # integer-array addition on PeriodIndex is deprecated,
            #  so we use _addsub_int_array directly
            shifted = base_period._addsub_int_array(roll, operator.add)
            base = shifted.to_timestamp(how='end')
        else:
            # integer addition on PeriodIndex is deprecated,
            #  so we use _time_shift directly
            roll = self.n
            base = base_period._time_shift(roll).to_timestamp(how='end')

        return base + off + Timedelta(1, 'ns') - Timedelta(1, 'D')
945239
def sum(self, axis=None, keepdims=False):
        
        return self.numpy().sum(axis=axis, keepdims=keepdims)
338017
def pivot(self, attrlist):
        
        if isinstance(attrlist, basestring):
            attrlist = attrlist.split()
        if all(a in self._indexes for a in attrlist):
            return PivotTable(self, [], attrlist)
        else:
            raise ValueError("pivot can only be called using indexed attributes")