Return the sum of the stats value for the given key.

        * indice: If indice is set, get the p[key][indice]
        * mmm: display min, max, mean or current (if mmm=None)
500367
def __sum_stats(self, key, indice=None, mmm=None):
        
        # Compute stats summary
        ret = 0
        for p in self.stats:
            if key not in p:
                # Correct issue #1188
                continue
            if p[key] is None:
                # Correct https://github.com/nicolargo/glances/issues/1105#issuecomment-363553788
                continue
            if indice is None:
                ret += p[key]
            else:
                ret += p[key][indice]

        # Manage Min/Max/Mean
        mmm_key = self.__mmm_key(key, indice)
        if mmm == 'min':
            try:
                if self.mmm_min[mmm_key] > ret:
                    self.mmm_min[mmm_key] = ret
            except AttributeError:
                self.mmm_min = {}
                return 0
            except KeyError:
                self.mmm_min[mmm_key] = ret
            ret = self.mmm_min[mmm_key]
        elif mmm == 'max':
            try:
                if self.mmm_max[mmm_key] < ret:
                    self.mmm_max[mmm_key] = ret
            except AttributeError:
                self.mmm_max = {}
                return 0
            except KeyError:
                self.mmm_max[mmm_key] = ret
            ret = self.mmm_max[mmm_key]

        return ret
1023955
@CheckForSigned
  private int _getPutIndex (final int key)
  {
    final int readIdx = _getReadIndex (key);
    if (readIdx >= 0)
      return readIdx;
    // key not found, find insertion point
    final int startIdx = MapHelper.phiMix (key) & m_nMask;
    if (m_aKeys[startIdx] == FREE_KEY)
      return startIdx;
    int idx = startIdx;
    while (m_aKeys[idx] != FREE_KEY)
    {
      idx = _getNextIndex (idx);
      if (idx == startIdx)
        return -1;
    }
    return idx;
  }
748089
def mean(self):
        """"""
        _self = self._discard_value(None)
        if not _self.total():
            return None
        weighted_sum = sum(
            key * value for key, value in iteritems(_self)
        )
        return weighted_sum / float(_self.total())
700007
def __sum(self, line):
        
        splitted_line = line.split()
        try:
            ret = sum(map(int, splitted_line[1:(self.cpu_number + 1)]))
        except ValueError:
            # Correct issue #1007 on some conf (Raspberry Pi with Raspbian)
            ret = 0
        return ret
26384
def get(self, key):
        '''
        
        '''
        if key in self._data_fields:
            return self._data_fields[key]
        if key in self._sub_reports:
            return self._sub_reports[key]
        return None
308376
def row_value(self, row):
        """"""
        irow = int(row)
        i = self._get_key_index(irow)
        if i == -1:
            return 0.0

        # Are we dealing with the last key?
        if i == len(self.keys) - 1:
            return self.keys[-1].value

        return TrackKey.interpolate(self.keys[i], self.keys[i + 1], row)
1154933
def totals(self):
        
        def agg(d):
            keys = ['g','a','p','pm','pn','pim','s','ab','ms','ht','gv','tk','bs']
            res = { k: 0 for k in keys }
            res['fo'] = { 'won': 0, 'total': 0 }
            for _, v in d.items():
                for k in keys:
                    res[k] += v[k]
                for fi in res['fo'].keys():
                    res['fo'][fi] += v['fo'][fi]
            return res
            
        return self.__apply_to_both(agg)
616934
def get_value(self, series, key):
        
        if not is_scalar(key):
            raise InvalidIndexError

        k = com.values_from_object(key)
        loc = self.get_loc(k)
        new_values = com.values_from_object(series)[loc]

        return new_values
1105626
def counter_mean_and_median(counter):
    
    if not counter:
        return np.nan, np.nan

    total = sum(v for k, v in counter.items())
    mid = total / 2
    weighted_sum = 0
    items_seen = 0
    median_found = False
    for k, v in sorted(counter.items()):
        weighted_sum += k * v
        items_seen += v
        if not median_found and items_seen >= mid:
            median = k
            median_found = True
    mean = weighted_sum * 1. / total
    return mean, median
531069
def mean(data):
    
    if iter(data) is data:
        data = list(data)
    n = len(data)
    if n < 1:
        raise StatisticsError('mean requires at least one data point')
    return sum(data) / n
1045573
def average(sequence, key):
    """"""
    return sum(map(key, sequence)) / float(len(sequence))
1207384
def get(self, key, index=None):
        
        records = self.get_multi([key], index=index)

        try:
            return records[0][1]  # return the value from the key/value tuple
        except IndexError:
            return None
628619
def zcount(self, key, min=float('-inf'), max=float('inf'),
               *, exclude=None):
        
        if not isinstance(min, (int, float)):
            raise TypeError("min argument must be int or float")
        if not isinstance(max, (int, float)):
            raise TypeError("max argument must be int or float")
        if min > max:
            raise ValueError("min could not be greater than max")
        return self.execute(b'ZCOUNT', key,
                            *_encode_min_max(exclude, min, max))
967220
public Long zcount(Object key, double min, double max) {
		Jedis jedis = getJedis();
		try {
			return jedis.zcount(keyToBytes(key), min, max);
		}
		finally {close(jedis);}
	}
1223546
def stats(self, key=None):
        
        # TODO: Stats with key is not working.

        returns = {}
        for server in self.servers:
            returns[server.server] = server.stats(key)

        return returns
613210
def get_int(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else int(value)
1078809
def total(self):
        
        url = "/stats/total"
        result = self._get(url)
        return StatModel.parse(result)