Apply on each data item
978671
function renderField(fieldName, index) {
      const field = model.provider.getField(fieldName);
      const fieldContainer = d3.select(this);
      let legendCell = fieldContainer.select(`.${style.jsLegend}`);
      let fieldCell = fieldContainer.select(`.${style.jsFieldName}`);

      // Apply style to row (selected/unselected)
      fieldContainer
        .classed(!field.active ? style.selectedRow : style.unselectedRow, false)
        .classed(field.active ? style.selectedRow : style.unselectedRow, true)
        .on('click', (name) => {
          model.provider.toggleFieldSelection(name);
        });

      // Create missing DOM element if any
      if (legendCell.empty()) {
        legendCell = fieldContainer.append('td').classed(style.legend, true);

        fieldCell = fieldContainer.append('td').classed(style.fieldName, true);
      }

      // Apply legend
      if (model.provider.isA('LegendProvider')) {
        const { color, shape } = model.provider.getLegend(fieldName);
        legendCell.html(`<svg class='${
          style.legendSvg
        }' width='${legendSize}' height='${legendSize}' viewBox='${
          shape.viewBox
        }'
                  fill='${color}' stroke='black'><use xlink:href='#${
          shape.id
        }'/></svg>`);
      } else {
        legendCell
          .html('<i></i>')
          .select('i')
          .classed(
            !field.active ? style.selectedRow : style.unselectedRow,
            false
          )
          .classed(
            field.active ? style.selectedRow : style.unselectedRow,
            true
          );
      }

      // Apply field name
      fieldCell.text(fieldName);

      if (model.fieldShowHistogram) {
        let minCell = fieldContainer.select(`.${style.jsHistMin}`);
        let histCell = fieldContainer.select(`.${style.jsSparkline}`);
        let maxCell = fieldContainer.select(`.${style.jsHistMax}`);

        if (histCell.empty()) {
          minCell = fieldContainer.append('td').classed(style.jsHistMin, true);
          histCell = fieldContainer.append('td').classed(style.sparkline, true);
          maxCell = fieldContainer.append('td').classed(style.jsHistMax, true);
          histCell
            .append('svg')
            .classed(style.sparklineSvg, true)
            .attr('width', model.fieldHistWidth)
            .attr('height', model.fieldHistHeight);
        }

        // make sure our data is ready. If not, render will be called when loaded.
        const hobj = model.histograms ? model.histograms[fieldName] : null;
        if (hobj) {
          histCell.style('display', hideField.hist ? 'none' : null);

          // only do work if histogram is displayed.
          if (!hideField.hist) {
            const cmax = 1.0 * d3.max(hobj.counts);
            const hsize = hobj.counts.length;
            const hdata = histCell
              .select('svg')
              .selectAll(`.${style.jsHistRect}`)
              .data(hobj.counts);

            hdata.enter().append('rect');
            // changes apply to both enter and update data join:
            hdata
              .attr(
                'class',
                (d, i) => (i % 2 === 0 ? style.histRectEven : style.histRectOdd)
              )
              .attr('pname', fieldName)
              .attr('y', (d) => model.fieldHistHeight * (1.0 - d / cmax))
              .attr('x', (d, i) => (model.fieldHistWidth / hsize) * i)
              .attr('height', (d) => model.fieldHistHeight * (d / cmax))
              .attr('width', model.fieldHistWidth / hsize);

            hdata.exit().remove();

            if (model.provider.isA('HistogramBinHoverProvider')) {
              histCell
                .select('svg')
                .on('mousemove', function inner(d, i) {
                  const mCoords = d3.mouse(this);
                  const binNum = Math.floor(
                    (mCoords[0] / model.fieldHistWidth) * hsize
                  );
                  const state = {};
                  state[fieldName] = [binNum];
                  model.provider.setHoverState({ state });
                })
                .on('mouseout', (d, i) => {
                  const state = {};
                  state[fieldName] = [-1];
                  model.provider.setHoverState({ state });
                });
            }
          }

          const formatter = d3.format('.3s');
          minCell
            .text(formatter(hobj.min))
            .style('display', hideField.minMax ? 'none' : null);
          maxCell
            .text(formatter(hobj.max))
            .style('display', hideField.minMax ? 'none' : null);
        }
      }
    }
645864
def apply(self, collection, ops, **kwargs):
        """"""
        validator = lambda obj: all(op(obj, val) for (op, val) in ops)  # noqa
        return [o for o in collection if validator(o)]
413055
function dataset(elem) {
        if (elem.dataset) {
            return JSON.parse(JSON.stringify(elem.dataset));
        }

        var target = {};

        if (elem.hasAttributes()) {
            each(elem.attributes, function (attr) {
                var name = attr.name;
                if (name.indexOf('data-') !== 0) {
                    return true;
                }

                name = name.replace(/^data-/i, '')
                    .replace(/-(\w)/g, function (all, letter) {
                        return letter.toUpperCase();
                    });

                target[name] = attr.value;
            });

            return target;
        }

        return {};
    }
648998
function setData(element, name, data) {
  if (isObject(data)) {
    element[name] = data;
  } else if (element.dataset) {
    element.dataset[name] = data;
  } else {
    element.setAttribute('data-' + hyphenate(name), data);
  }
}
142504
public function apply()
    {
        $input = $this->grid->getInputProcessor()->getInput();
        $sort = null;
        if (isset($input['sort'])) {
            foreach ($input['sort'] as $field => $direction) {
                $sort = [$field, $direction];
                break;
            }
        }
        foreach ($this->grid->getConfig()->getColumns() as $column) {
            if ($sort) {
                if ($column->getName() === $sort[0]) {
                    $column->setSorting($sort[1]);
                } else {
                    $column->setSorting(null);
                }
            } else {
                if ($direction = $column->getSorting()) {
                    $sort = [$column->getName(), $direction];
                }
            }
        }
        if ($sort) {
            $this
                ->grid
                ->getConfig()
                ->getDataProvider()
                ->orderBy($sort[0], $sort[1]);
        }
    }
316404
def _fix_data_select(self):
        

        elements = self.document.select('*')
        for element in elements:
            attributes = element.attrs.keys()
            data_attributes = list()
            for attribute in attributes:
                if bool(re.findall('^data-', attribute)):
                    data_attributes.append({
                        'original': attribute,
                        'modified': re.sub('data-', 'dataaaaaa', attribute),
                        'value': element[attribute]
                    })
            if data_attributes:
                auxiliar_element = BeautifulSoupHTMLDOMElement(element)
                for data_attribute in data_attributes:
                    auxiliar_element.remove_attribute(
                        data_attribute['original']
                    )
                    auxiliar_element.set_attribute(
                        data_attribute['modified'],
                        data_attribute['value']
                    )
1222566
def apply(self, func, *args, **kwargs):
        
        self._prep_pandas_groupby()

        def key_by_index(data):
            """Key each row by its index.
            """
            # TODO: Is there a better way to do this?
            for key, row in data.iterrows():
                yield (key, pd.DataFrame.from_dict(
                    dict([(key, row)]), orient='index'))

        myargs = self._myargs
        mykwargs = self._mykwargs
        regroupedRDD = self._distributedRDD.mapValues(
            lambda data: data.groupby(*myargs, **mykwargs))
        appliedRDD = regroupedRDD.map(
            lambda key_data: key_data[1].apply(func, *args, **kwargs))
        reKeyedRDD = appliedRDD.flatMap(key_by_index)
        dataframe = self._sortIfNeeded(reKeyedRDD).values()
        return DataFrame.fromDataFrameRDD(dataframe, self.sql_ctx)
163682
function applyFilter(data, restrictedFields, allowedFields) {
    var filterFunc;

    // if string, something like a sort where each word should be a value
    var isString = _.isString(data);
    if (isString) { data = data.split(' '); }

    if (restrictedFields) {
        filterFunc = _.isArray(data) ? removeItemsFromList : removeFieldsFromObj;
        data = filterFunc(data, restrictedFields);
    }
    else if (allowedFields) {
        filterFunc = _.isArray(data) ? getItemsFromList : getFieldsFromObj;
        data = filterFunc(data, allowedFields);
    }

    return isString ? data[0] : data;
}
651586
function _apply (mat, dim, callback) {
  let i, ret, tran

  if (dim <= 0) {
    if (!Array.isArray(mat[0])) {
      return callback(mat)
    } else {
      tran = _switch(mat)
      ret = []
      for (i = 0; i < tran.length; i++) {
        ret[i] = _apply(tran[i], dim - 1, callback)
      }
      return ret
    }
  } else {
    ret = []
    for (i = 0; i < mat.length; i++) {
      ret[i] = _apply(mat[i], dim - 1, callback)
    }
    return ret
  }
}
1034923
def col_apply(self, col, func, *args, **kwargs):
        
        if col in self.data:
            self.data[col] = self.data[col].apply(func, *args, **kwargs)
        else:
            self.meta[col] = self.meta[col].apply(func, *args, **kwargs)
900041
function applyEvents(context, child, data) {
        var events = context.events[child.name];
        if (events !== undefined && child.el !== undefined && child.data.type !== 'cp') {
            events.forEach((event)=> {
                context._events.push(child.on(event.name, event.action, context, data));
            });
        }
    }
500521
function groupData(data, dim) {
    var groups = {};

    each(data, function (record) {
      var value = record[dim];
      if (value === undefined) {
        value = record[dim] = DEFAULT_Y;
      }
      if (!groups[value]) {
        groups[value] = [];
      }
      groups[value].push(record);
    });

    return groups;
  }
87914
private void applyFilter(){
        filteredItems.clear();

        Filter<M> filter = getFilter();
        if(filter == null){
            filteredItems.addAll(items);
        }else{
            for (int i = 0; i < items.size(); i++) {
                M item = items.get(i);
                if(filter.filter(item, query)){
                    filteredItems.add(item);
                }
            }
        }

        onFiltered();
    }
876356
function addData(chart, label, data) {
    chart.data.labels.push(label)
    chart.data.datasets.forEach((dataset) => {
        dataset.data.push(data)
    })
    chart.update()
}
1236540
def data(self, data):
        """"""
        self._data = {det: d.copy() for (det, d) in data.items()}
1269178
def add(bullet, *items)
      items.each do |item|
        @bullet_data << [bullet.to_s, item]
        bullet = ""
      end
    end
237125
def apply(self, data, path=None, applicator=None):
        

        if applicator:
            applicator.pset = self
        else:
            applicator = Applicator(self)

        return applicator.apply(data, path=path)