Add columns as needed:
        age, age_unit, specimen, sample, site, location.
553944
def add_age_defaults(self):
        
        if isinstance(self.magic_dataframe, cb.MagicDataFrame):
            for col in ['age', 'age_unit']:
                if col not in self.grid.col_labels:
                    self.grid.add_col(col)
            for level in ['locations', 'sites', 'samples', 'specimens']:
                if level in self.contribution.tables:
                    if level[:-1] not in self.grid.col_labels:
                        self.grid.add_col(level[:-1])
730694
protected function define_table_columns() {
        $extrafields = get_extra_user_fields($this->context);

        // Define headers and columns.
        $cols = array(
            'timemodified' => get_string('datetime', 'gradereport_history'),
            'fullname' => get_string('name')
        );

        // Add headers for extra user fields.
        foreach ($extrafields as $field) {
            if (get_string_manager()->string_exists($field, 'moodle')) {
                $cols[$field] = get_string($field);
            } else {
                $cols[$field] = $field;
            }
        }

        // Add remaining headers.
        $cols = array_merge($cols, array(
            'itemname' => get_string('gradeitem', 'grades'),
            'prevgrade' => get_string('gradeold', 'gradereport_history'),
            'finalgrade' => get_string('gradenew', 'gradereport_history'),
            'grader' => get_string('grader', 'gradereport_history'),
            'source' => get_string('source', 'gradereport_history'),
            'overridden' => get_string('overridden', 'grades'),
            'locked' => get_string('locked', 'grades'),
            'excluded' => get_string('excluded', 'gradereport_history'),
            'feedback' => get_string('feedbacktext', 'gradereport_history')
            )
        );

        $this->define_columns(array_keys($cols));
        $this->define_headers(array_values($cols));
    }
109244
def add_specimen(self, spec_name, samp_name=None, er_data=None, pmag_data=None):
        
        if samp_name:
            sample = self.find_by_name(samp_name, self.samples)
            if not sample:
                print("""-W- {} is not a currently existing sample.
Creating a new sample named: {} """.format(samp_name, samp_name))
                sample = self.add_sample(samp_name)
        else:
            sample = None

        specimen = Specimen(spec_name, sample, self.data_model, er_data, pmag_data)

        self.specimens.append(specimen)
        if sample:
            sample.specimens.append(specimen)
        return specimen
4270
protected void assemble(Fields fields) {
        if (getBase() == null) {
            super.assemble(fields);

            fields.era = ERA_FIELD;
            fields.monthOfYear = new BasicMonthOfYearDateTimeField(this, 12);
            fields.months = fields.monthOfYear.getDurationField();
        }
    }
219968
def _add_data_to_general_stats(self, data):
    
    headers = _get_general_stats_headers()

    self.general_stats_headers.update(headers)

    header_names = ('ERROR_count', 'WARNING_count', 'file_validation_status')

    general_data = dict()
    for sample in data:
        general_data[sample] = {column: data[sample][column] for column in header_names}
        if sample not in self.general_stats_data:
            self.general_stats_data[sample] = dict()
        if data[sample]['file_validation_status'] != 'pass':
            headers['file_validation_status']['hidden'] = False
        self.general_stats_data[sample].update(general_data[sample])
1047967
def AddTableColumns(self, table, columns):
    """"""
    table_columns = self._table_columns.setdefault(table, [])
    for attr in columns:
      if attr not in table_columns:
        table_columns.append(attr)
773300
def add_to_fields(self):
        ''''''
        meta = self.model._meta
        meta.scalarfields.append(self)
        if self.index:
            meta.indices.append(self)
1033175
private function enhanceColumns(): void
  {
    foreach ($this->oldColumns as $table)
    {
      foreach ($table as $column)
      {
        $table_name  = $column['table_name'];
        $column_name = $column['column_name'];

        if ($column['constant_name']=='*')
        {
          $constant_name                                                = strtoupper($column['column_name']);
          $this->oldColumns[$table_name][$column_name]['constant_name'] = $constant_name;
        }
        else
        {
          $constant_name                                                = strtoupper($this->oldColumns[$table_name][$column_name]['constant_name']);
          $this->oldColumns[$table_name][$column_name]['constant_name'] = $constant_name;
        }
      }
    }
  }
353798
def _add_column_and_format(self, table, label, column):
        """"""
        label = self._as_label(label)
        table[label] = column
        if label in self._formats:
            table._formats[label] = self._formats[label]
1358147
def add_new_grid_headers(self, new_headers):
        
        already_present = []
        for name in new_headers:
            if name:
                if name not in self.grid.col_labels:
                    col_number = self.grid.add_col(name)
                    # add to appropriate headers list
                    # add drop down menus for user-added column
                    if name in self.contribution.vocab.vocabularies:
                        self.drop_down_menu.add_drop_down(col_number, name)
                    elif name in self.contribution.vocab.suggested:
                        self.drop_down_menu.add_drop_down(col_number, name)
                    elif name in ['specimen', 'sample', 'site',
                                  'specimens', 'samples', 'sites']:
                        self.drop_down_menu.add_drop_down(col_number, name)
                    elif name == 'experiments':
                        self.drop_down_menu.add_drop_down(col_number, name)
                    if name == "method_codes":
                        self.drop_down_menu.add_method_drop_down(col_number, name)
                else:
                    already_present.append(name)
                    #pw.simple_warning('You are already using column header: {}'.format(name))
        return already_present
139055
protected void appendWhereClause(StringBuffer stmt, Object[] columns)
    {
        stmt.append(" WHERE ");

        for (int i = 0; i < columns.length; i++)
        {
            if (i > 0)
            {
                stmt.append(" AND ");
            }
            stmt.append(columns[i]);
            stmt.append("=?");
        }
    }
94455
protected void setupPivotInfo() {
        for( int col = 0; col < numCols; col++ ) {
            pivots[col] = col;
            double c[] = dataQR[col];
            double norm = 0;
            for( int row = 0; row < numRows; row++ ) {
                double element = c[row];
                norm += element*element;
            }
            normsCol[col] = norm;
        }
    }
893226
def resizeColumnsToContents(self):
        """"""
        self._autosized_cols = set()
        self._resizeColumnsToContents(self.table_level,
                                      self.table_index, self._max_autosize_ms)
        self._update_layout()
1039840
def InitUI(self):
        
        if self.data_type in ['orient', 'ages']:
            belongs_to = []
        else:
            parent_table_name = self.parent_type + "s"
            if parent_table_name in self.contribution.tables:
                belongs_to = sorted(self.contribution.tables[parent_table_name].df.index.unique())
            else:
                belongs_to = []

        self.choices = {}
        if self.data_type in ['specimens', 'samples', 'sites']:
            self.choices = {1: (belongs_to, False)}
        if self.data_type == 'orient':
            self.choices = {1: (['g', 'b'], False)}
        if self.data_type == 'ages':
            for level in ['specimen', 'sample', 'site', 'location']:
                if level in self.grid.col_labels:
                    level_names = []
                    if level + "s" in self.contribution.tables:
                        level_names = list(self.contribution.tables[level+"s"].df.index.unique())
                    num = self.grid.col_labels.index(level)
                    self.choices[num] = (level_names, False)
        # Bind left click to drop-down menu popping out
        self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
                       lambda event: self.on_left_click(event, self.grid, self.choices))

        cols = self.grid.GetNumberCols()
        col_labels = [self.grid.GetColLabelValue(col) for col in range(cols)]

        # check if any additional columns have controlled vocabularies
        # if so, get the vocabulary list
        for col_number, label in enumerate(col_labels):
            self.add_drop_down(col_number, label)
1050616
def add_sample(self, name, labels, value, timestamp=None, exemplar=None):
        """"""
        self.samples.append(Sample(name, labels, value, timestamp, exemplar))
762926
def add_columns(t0, t1):
    """"""

    for colname in t1.colnames:
        col = t1.columns[colname]
        if colname in t0.columns:
            continue
        new_col = Column(name=col.name, length=len(t0), dtype=col.dtype)  # ,
        # shape=col.shape)
        t0.add_column(new_col)
261274
public static void addColumnsToScan(Collection<String> columns, final Scan scan) {
    addColumnsToOperation(columns, new Operation() {
      @Override
      public void addColumn(byte[] family, byte[] column) {
        scan.addColumn(family, column);
      }

      @Override
      public void addFamily(byte[] family) {
        scan.addFamily(family);
      }
    });
  }