forward fill missing values
554152
def ffill(arr, dim=None, limit=None):
    ''''''
    import bottleneck as bn

    axis = arr.get_axis_num(dim)

    # work around for bottleneck 178
    _limit = limit if limit is not None else arr.shape[axis]

    return apply_ufunc(bn.push, arr,
                       dask='parallelized',
                       keep_attrs=True,
                       output_dtypes=[arr.dtype],
                       kwargs=dict(n=_limit, axis=axis)).transpose(*arr.dims)
438886
def fill_row(self, forward, items, idx, row, ro, ri, overlap,lengths):
        ""
        ibuf = n = 0
        ro  -= 1
        while ibuf < row.size:
            ro   += 1
            ix    = idx[ro]
            rag   = items[ix]
            if forward:
                ri = 0 if ibuf else ri
                n  = min(lengths[ix] - ri, row.size - ibuf)
                row[ibuf:ibuf+n] = rag[ri:ri+n]
            else:
                ri = lengths[ix] if ibuf else ri
                n  = min(ri, row.size - ibuf)
                row[ibuf:ibuf+n] = rag[ri-n:ri][::-1]
            ibuf += n
        return ro, ri + ((n-overlap) if forward else -(n-overlap))
1101207
function fillFinders(matrix) {
    var N = matrix.length;
    for (var i = -3; i <= 3; i++) {
        for (var j = -3; j <= 3; j++) {
            var max = Math.max(i, j);
            var min = Math.min(i, j);
            var pixel = (max == 2 && min >= -2) || (min == -2 && max <= 2) ? 0x80 : 0x81;
            matrix[3 + i][3 + j] = pixel;
            matrix[3 + i][N - 4 + j] = pixel;
            matrix[N - 4 + i][3 + j] = pixel;
        }
    }
    for (var i = 0; i < 8; i++) {
        matrix[7][i] = matrix[i][7] =
        matrix[7][N - i - 1] = matrix[i][N - 8] =
        matrix[N - 8][i] = matrix[N - 1 - i][7] = 0x80;
    }
}
950834
def fill_values_to_nan(masked_array):
    
    if masked_array is not None and masked_array.dtype.kind == 'f':
        check_class(masked_array, ma.masked_array)
        logger.debug("Replacing fill_values by NaNs")
        masked_array[:] = ma.filled(masked_array, np.nan)
        masked_array.set_fill_value(np.nan)
    else:
        return masked_array
475167
def _fill(self):
    """"""
    try:
      self._head = self._iterable.next()
    except StopIteration:
      self._head = None
187030
def fill_value(dtype):
    '''
    '''
    if np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.complexfloating):
        return dtype(np.nan)

    return dtype(0)
762163
def _normalize_missing(g):
        """"""
        g = g.astype(float)
        g[g == -1.0] = np.nan
        return g
1077805
def forward_substitute(l, s)
			raise 'l must be a lower triangular matrix' unless l.lower_triangular?

			x = Array.new s.row_size

			x.size.times do |i|
				x[i] = s[i, 0]

				i.times do |j|
					x[i] -= l[i, j] * x[j]
				end

				x[i] /= l[i, i]
			end

			Matrix.column_vector x
		end
717328
def median_fill(adf):
        
        ordpt = adf.values[0]
        if not pd.isnull(ordpt):
            return ordpt

        fdmn = adf.iloc[1:-1].median()
        if not pd.isnull(fdmn):
            return fdmn

        flspt = adf.values[-1]
        if not pd.isnull(flspt):
            return flspt

        return nan
1016365
int fillBackwardFrom0(int itemIndex, double upTo) {
        double min = orientation.minY(positioner.getVisibleCell(itemIndex));
        int i = itemIndex;
        while(min > upTo && i > 0) {
            --i;
            C c = positioner.placeEndFromStart(i, min);
            min = orientation.minY(c);
        }
        return i;
    }
235523
def find_forward(data, offset = 0, length = data.length)
      node = nil
      lastvaluenode = nil
      i = offset
      while (i<offset+length)
        c = data[i]
        if (node == nil)
          node = self.find_horizontal(c)
        elsif (node.down != nil)
          node = node.down.find_horizontal(c)
        else
          return lastvaluenode
        end
        return lastvaluenode  if (node == nil)
        lastvaluenode = node if (node.value != nil)
        i += 1
      end
      lastvaluenode
    end
847529
def _infer_fill_value(val):
    

    if not is_list_like(val):
        val = [val]
    val = np.array(val, copy=False)
    if is_datetimelike(val):
        return np.array('NaT', dtype=val.dtype)
    elif is_object_dtype(val.dtype):
        dtype = lib.infer_dtype(ensure_object(val), skipna=False)
        if dtype in ['datetime', 'datetime64']:
            return np.array('NaT', dtype=_NS_DTYPE)
        elif dtype in ['timedelta', 'timedelta64']:
            return np.array('NaT', dtype=_TD_DTYPE)
    return np.nan
424823
def forward(self, X):
        """"""
        # Identify the first non-zero integer from the right (i.e., the length
        # of the sequence before padding starts).
        batch_size, max_seq = X.shape[0], X.shape[1]
        seq_lengths = torch.zeros(batch_size, dtype=torch.long)
        for i in range(batch_size):
            for j in range(max_seq - 1, -1, -1):
                if not torch.all(X[i, j] == 0):
                    seq_lengths[i] = j + 1
                    break

        # Sort by length because pack_padded_sequence requires it
        # Save original order to restore before returning
        seq_lengths, perm_idx = seq_lengths.sort(0, descending=True)
        X = X[perm_idx]
        inv_perm_idx = torch.tensor(
            [i for i, _ in sorted(enumerate(perm_idx), key=lambda idx: idx[1])],
            dtype=torch.long,
        )

        # Encode and pack input sequence
        X_packed = rnn_utils.pack_padded_sequence(
            self.encoder.encode(X), seq_lengths, batch_first=True
        )

        # Run LSTM
        outputs, (h_t, c_t) = self.lstm(X_packed)

        # Unpack and reduce outputs
        outputs_unpacked, _ = rnn_utils.pad_packed_sequence(outputs, batch_first=True)
        reduced = self._reduce_output(outputs_unpacked, seq_lengths)
        return reduced[inv_perm_idx, :]
626915
function fill() {

        if (self.pgrid.filteredDataSource != null && self.dimensionsCount > 0) {

            var datasource = self.pgrid.filteredDataSource;
            if (datasource != null && utils.isArray(datasource) && datasource.length > 0) {
                for (var rowIndex = 0, dataLength = datasource.length; rowIndex < dataLength; rowIndex++) {
                    var row = datasource[rowIndex];
                    var dim = self.root;
                    for (var findex = 0; findex < self.dimensionsCount; findex++) {
                        var depth = self.dimensionsCount - findex;
                        var subfield = self.fields[findex];
                        var subvalue = row[subfield.name];
                        var subdimvals = dim.subdimvals;

                        if (subdimvals[subvalue] !== undefined) {
                            dim = subdimvals[subvalue];
                        } else {
                            dim.values.push(subvalue);
                            dim = new Dimension(++dimid, dim, subvalue, subfield, depth, false, findex == self.dimensionsCount - 1);
                            subdimvals[subvalue] = dim;
                            dim.rowIndexes = [];
                            self.dimensionsByDepth[depth].push(dim);
                        }

                        dim.rowIndexes.push(rowIndex);
                    }
                }
            }
        }
    }
1217472
def _fill(self, direction, limit=None):
        """"""
        res = super()._fill(direction, limit=limit)
        output = OrderedDict(
            (grp.name, grp.grouper) for grp in self.grouper.groupings)

        from pandas import concat
        return concat((self._wrap_transformed_output(output), res), axis=1)
233971
def populate_unpaired_line(d_vals, f_f_header, missing_val=None):
  
  if missing_val is None:
    raise MissingValueError("Need missing value to output " +
                            " unpaired lines")
  if f_f_header is not None:
    f_f_flds = [dict(zip(f_f_header, [missing_val] * len(f_f_header)))]
  else:
    assert(len(d_vals) > 0)
    f_f_num_cols = len(d_vals[d_vals.keys()[0]][0])
    f_f_flds = [[missing_val] * f_f_num_cols]
  return f_f_flds
1359473
def _fill_untouched(idx, ret, fill_value):
    """"""
    untouched = np.ones_like(ret, dtype=bool)
    untouched[idx] = False
    ret[untouched] = fill_value