Update parameters for selected dataframe after a completed batch
        Parameters
        ----------
        dataframe : pandas.DataFrame
            Selected dataframe needs to be modified.
199934
def _process_batch(self, param, dataframe):
        
        now = time.time()
        if param.eval_metric is not None:
            metrics = dict(param.eval_metric.get_name_value())
            param.eval_metric.reset()
        else:
            metrics = {}
        # #11504
        try:
            speed = self.frequent / (now - self.last_time)
        except ZeroDivisionError:
            speed = float('inf')
        metrics['batches_per_sec'] = speed * self.batch_size
        metrics['records_per_sec'] = speed
        metrics['elapsed'] = self.elapsed()
        metrics['minibatch_count'] = param.nbatch
        metrics['epoch'] = param.epoch
        self.append_metrics(metrics, dataframe)
        self.last_time = now
1269848
def reset_index(self):
        
        new_columns = OrderedDict()

        new_index = default_index(_obtain_length(self._length, self._data))

        new_columns.update((name, Series(data.values, new_index, data.dtype, name))
                           for name, data in self.index._gather_data().items())

        # the data/columns
        new_columns.update((sr.name, Series(sr.values, new_index, sr.dtype, sr.name))
                           for sr in self._iter())

        return DataFrame(new_columns, new_index)
279557
protected void updateFromSelection() {
    DBIDSelection sel = context.getSelection();
    if(sel != null) {
      this.dbids = DBIDUtil.newArray(sel.getSelectedIds());
      this.dbids.sort();
    }
    else {
      this.dbids = DBIDUtil.newArray();
    }
  }
443339
def _selectedRepoRow(self):
        
        # TODO - figure out what happens if no repo is selected
        selectedModelIndexes = \
            self.reposTableWidget.selectionModel().selectedRows()
        for index in selectedModelIndexes:
            return index.row()
848997
def update_params(self, param_d):
        
        for param in self.paramlst:
            if param.name in param_d:
                value = param_d[param.name]
                setattr(self.obj, param.name, value)
494754
def update_selection(self):
        

        # clear all boxes
        self.clear_boxes()
        self.draw_figure(self.s)

        # update temperature list
        if self.Data[self.s]['T_or_MW'] == "T":
            self.temperatures = np.array(self.Data[self.s]['t_Arai']) - 273.
        else:
            self.temperatures = np.array(self.Data[self.s]['t_Arai'])

        self.T_list = ["%.0f" % T for T in self.temperatures]
        self.tmin_box.SetItems(self.T_list)
        self.tmax_box.SetItems(self.T_list)
        self.tmin_box.SetValue("")
        self.tmax_box.SetValue("")
        self.Blab_window.SetValue(
            "%.0f" % (float(self.Data[self.s]['pars']['lab_dc_field']) * 1e6))
        if "saved" in self.Data[self.s]['pars']:
            self.pars = self.Data[self.s]['pars']
            self.update_GUI_with_new_interpretation()
        self.Add_text(self.s)
        self.write_sample_box()
223468
def transform_dataframe(self, dataframe):
        
        dataframe.columns.name = ""

        for i in range(len(self.get_header_fields())):
            dataframe = dataframe.unstack()

        # Remove blank rows / columns
        dataframe = dataframe.dropna(
            axis=0, how='all'
        ).dropna(
            axis=1, how='all'
        )
        return dataframe
1057698
def backup(self):
        
        try:
            self.backup_df = self.df.copy()
        except Exception as e:
            self.err(e, "Can not backup data")
            return
        self.ok("Dataframe backed up")
946493
def update_where(self, col, value, where_col_list, where_value_list):
        
        if type(col) is str:
            col_ndx = self.get_col_by_name(col)
        else:
            col_ndx = col
        #print('col_ndx = ', col_ndx    )
        #print("updating " + col + " to " , value, " where " , where_col_list , " = " , where_value_list)
        new_arr = self.select_where(where_col_list, where_value_list)
        #print('new_arr', new_arr)
        for r in new_arr:
            self.arr[r[0]][col_ndx] = value
176987
def update(self, series_data):
        

        for key in series_data:
            try:
                data_list = list(self.data[key])
                data_list[2] = str(series_data[key])
                self.data[key] = tuple(data_list)
            except KeyError:
                pass
1093363
def _init_dataframes(self):
        
        df = pd.read_sql_query("SELECT elapsed, epoch, scriptrun_time, custom_timers FROM result ORDER BY epoch ASC",
                               db.get_conn())

        self._get_all_timers(df)
        self.main_results = self._get_processed_dataframe(df)

        # create all custom timers dataframes
        for key, value in six.iteritems(self._timers_values):
            df = pd.DataFrame(value, columns=['epoch', 'scriptrun_time'])
            df.index = pd.to_datetime(df['epoch'], unit='s')
            timer_results = self._get_processed_dataframe(df)
            self.timers_results[key] = timer_results

        # clear memory
        del self._timers_values
777929
def edit(self, **args):
        
        if self.model.exists(args["index"]):
            values = dict(zip(
                ['parent', 'name', 'priority', 'comment', 'done'],
                self.model.get(args["index"])
            ))
            kwargs = self.getKwargs(args, values)
            if kwargs:
                self.model.edit(args["index"], **kwargs)
183482
def set_batch(self, data):
    
    

    # fetch existing documents to get current revisions
    rows = self.bucket.view("_all_docs", keys=data.keys(), include_docs=True)
    existing = {}
    for row in rows:
      key = row.id
      if key and not data[key].has_key("_rev"):
        data[key]["_rev"] = row.doc["_rev"]

    for id,item in data.items():
      data[id]["_id"] = id

    revs = {}
    for success, docid, rev_or_exc in self.bucket.update(data.values()):
      if not success and self.logger:
        self.logger.error("Document update conflict (batch) '%s', %s" % (docid, rev_or_exc))
      elif success:
        revs[docid] = rev_or_exc

    return revs
162815
def updateParams(self, newvalues, update_all=False):
        """"""
        assert all(map(lambda x: x in self.freeparams, newvalues.keys())),\
                "Invalid entry in newvalues: {0}\nfreeparams: {1}".format(
                ', '.join(newvalues.keys()), ', '.join(self.freeparams))
        changed = set([]) # contains string names of changed params
        for (name, value) in newvalues.items():
            _checkParam(name, value, self.PARAMLIMITS, self.PARAMTYPES)
            if isinstance(value, scipy.ndarray):
                if (value != getattr(self, name)).any():
                    changed.add(name)
                    setattr(self, name, value.copy())
            else:
                if value != getattr(self, name):
                    changed.add(name)
                    setattr(self, name, copy.copy(value))

        if update_all or changed:
            self._cached = {}

        # The order of the updating below is important.
        # If you change it, you may break either this class
        # **or** classes that inherit from it.
        # Note also that not all attributes need to be updated
        # for all possible parameter changes, but just doing it
        # this way is much simpler and adds negligible cost.
        if update_all or (changed and changed != set(['mu'])):
            self._update_Pxy()
            self._update_Pxy_diag()
            self._update_dPxy()
            self._update_B()
1330515
def _add_new_columns(dataframe, metrics):
    
    #TODO(leodirac): we don't really need to do this on every update.  Optimize
    new_columns = set(metrics.keys()) - set(dataframe.columns)
    for col in new_columns:
        dataframe[col] = None
1186009
def insert_at(df, sample_date, values):
    
    observed_dt = dt(datetime.now())
    return multi_index_insert_row(df, [sample_date, observed_dt], values)
806132
def add_items(self, dataframe, hide_cols=()):
        
        # replace "None" values with ""
        dataframe = dataframe.fillna("")
        # remove any columns that shouldn't be shown
        for col in hide_cols:
            if col in dataframe.columns:
                del dataframe[col]
        # add more rows
        self.AppendRows(len(dataframe))
        columns = dataframe.columns
        row_num = -1
        # fill in all rows with appropriate values
        for ind, row in dataframe.iterrows():
            row_num += 1
            for col_num, col in enumerate(columns):
                value = row[col]
                self.SetCellValue(row_num, col_num, str(value))
                # set citation default value
                if col == 'citations':
                    citation = row['citations']
                    if (citation is None) or (citation is np.nan):
                            self.SetCellValue(row_num, col_num, 'This study')
                    else:
                        if 'This study' not in citation:
                            if len(citation):
                                citation += ':'
                            citation += 'This study'
                            self.SetCellValue(row_num, col_num, citation)
        self.row_labels.extend(dataframe.index)