Returns a list of average current numbers, each representing the
        average over the last n data points.

        Args:
            n: Number of data points to average over.

        Returns:
            A list of average current values.
763647
def get_average_record(self, n):
        
        history_deque = collections.deque()
        averages = []
        for d in self.data_points:
            history_deque.appendleft(d)
            if len(history_deque) > n:
                history_deque.pop()
            avg = sum(history_deque) / len(history_deque)
            averages.append(round(avg, self.lr))
        return averages
106569
def get_average(self, default=None):
        
        try:
            first_row = self.get_first()
            if first_row:
                count0 = first_row[0]['Count']
            else:
                count0 = 0
            average = (self.count - count0) / (self.get_number_of_rows() - 1)
        except Exception as e:
            logging.error(e)
            return default
        else:
            return average
134483
def timedelta_average(*values: datetime.timedelta) -> datetime.timedelta:
    
    """
    if isinstance(values[0], (list, tuple)):
        values = values[0]
    return sum(values, datetime.timedelta()) // len(values)
584334
def get_a(values, n):
        
        m = len(values)-n
        a = numpy.empty((m, n), dtype=float)
        for i in range(m):
            i0 = i-1 if i > 0 else None
            i1 = i+n-1
            a[i] = values[i1:i0:-1]
        return numpy.array(a)
530842
def moving_average(self, data, days):
        
        result = []
        data = data[:]
        for dummy in range(len(data) - int(days) + 1):
            result.append(round(sum(data[-days:]) / days, 2))
            data.pop()
        result.reverse()
        return result
434025
def _averageFromList(self, param):
        
        _result = 0.0
        _count = 0

        for _param in param.split(','):
            if _param != '' and float(_param) != 0.0:
                _result = _result + float(_param)
                _count  += 1

        if _count >= 1:
            _result = _result / _count
        return _result
865409
def points(self):
        
        vtk_data = self.GetPoints().GetData()
        arr = vtk_to_numpy(vtk_data)
        return vtki_ndarray(arr, vtk_data)
1256349
def sum_of_reoccurring_data_points(x):
    
    unique, counts = np.unique(x, return_counts=True)
    counts[counts < 2] = 0
    return np.sum(counts * unique)
1045573
def average(sequence, key):
    """"""
    return sum(map(key, sequence)) / float(len(sequence))
1116560
public TimingStatistics average(long n) {
        return TimingStatistics.builder()
                .ndarrayCreationTimeNanos(ndarrayCreationTimeNanos / n)
                .bandwidthDeviceToHost(bandwidthDeviceToHost / n)
                .diskReadingTimeNanos(diskReadingTimeNanos / n)
                .bandwidthNanosHostToDevice(bandwidthNanosHostToDevice / n)
                .build();
    }
846762
def read(self, n):
        
        self._check_underflow(n)
        rval = self._input[self._pos:self._pos + n]
        self._pos += n
        return rval
1315713
public static <N extends Number> Number average(List<N> numberList) {
        return cal(numberList, DoubleStream::average);
    }
257558
def N(self):
        
        if hasattr(self, 'sitecol'):
            return len(self.sitecol.complete) if self.sitecol else None
        return len(self.datastore['sitecol/array'])
473741
def raw(self, n=1):
        
        size = self.__strct.size  # struct size
        dataset = list()          # list of raw data

        try:
            # For n times...
            for _ in range(n):
                data = self.__file.read(size)  # get raw data from file
                dataset.append(data)           # save raw data in the list
        finally:
            return dataset
1162123
def averageSequenceAccuracy(self, minOverlap, maxOverlap):
    
    numCorrect = 0.0
    numStats = 0.0
    prefix = "L4 PredictedActive"

    # For each object
    for stats in self.statistics:

      # Keep running total of how often the number of predictedActive cells are
      # in the range.
      for key in stats.iterkeys():
        if prefix in key:
          for numCells in stats[key]:
            numStats += 1.0
            if numCells in range(minOverlap, maxOverlap + 1):
              numCorrect += 1.0

    return numCorrect / numStats
1142094
def _numbers_units(N):
    
    lst = range(1, N + 1)
    return "".join(list(map(lambda i: str(i % 10), lst)))
234990
def loadNumpyAnnotations(self, data):
        
        print('Converting ndarray to lists...')
        assert(type(data) == np.ndarray)
        print(data.shape)
        assert(data.shape[1] == 7)
        N = data.shape[0]
        ann = []
        for i in range(N):
            if i % 1000000 == 0:
                print('{}/{}'.format(i,N))
            ann += [{
                'image_id'  : int(data[i, 0]),
                'bbox'  : [ data[i, 1], data[i, 2], data[i, 3], data[i, 4] ],
                'score' : data[i, 5],
                'category_id': int(data[i, 6]),
                }]
        return ann