Take a contribution with a measurement table.
        Create specimen, sample, site, and location tables
        using the unique names in the measurement table to fill in
        the index.
327542
def propagate_measurement_info(self):
        
        meas_df = self.tables['measurements'].df
        names_list = ['specimen', 'sample', 'site', 'location']
        # add in any tables that you can
        for num, name in enumerate(names_list):
            # don't replace tables that already exist
            if (name + "s") in self.tables:
                continue
            elif name in meas_df.columns:
                items = meas_df[name].unique()
                df = pd.DataFrame(columns=[name], index=items)
                df[name] = df.index
                # add in parent name if possible
                # (i.e., sample name to specimens table)
                if num < (len(names_list) - 1):
                    parent = names_list[num+1]
                    if parent in meas_df.columns:
                        meas_df = meas_df.where(meas_df.notnull(), "")
                        df[parent] = meas_df.drop_duplicates(subset=[name])[parent].values.astype(str)
                df = df.where(df != "", np.nan)
                df = df.dropna(how='all', axis='rows')
                if len(df):
                    self.tables[name + "s"] = MagicDataFrame(dtype=name + "s", df=df)
                    self.write_table_to_file(name + "s")
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)
1152642
def create_table(self, names=None):
        

        scan_shape = (1,)
        for src in self._srcs:
            scan_shape = max(scan_shape, src['dloglike_scan'].shape)

        tab = create_source_table(scan_shape)
        for s in self._srcs:
            if names is not None and s.name not in names:
                continue
            s.add_to_table(tab)

        return tab
1114110
def _create_values_table(self):
        """"""
        # number of existing character, and returned dicts
        len_alph = len(self.alphabet)
        identificators_table = {k:{} for k in self.voc_values.keys()}
        identificators_sizes = {k:-1 for k in self.voc_values.keys()}

        for lexem_type, vocabulary in self.voc_values.items():
            # find number of different values that can be found, 
            #   and size of an identificator.
            len_vocb = len(vocabulary)
            identificators_sizes[lexem_type] = ceil(log(len_vocb, len_alph))
            # create list of possible identificators 
            num2alph = lambda x, n: self.alphabet[(x // len_alph**n) % len_alph]
            identificators = [[str(num2alph(x, n)) 
                               for n in range(identificators_sizes[lexem_type])
                              ] # this list is an identificator
                              for x in range(len_alph**identificators_sizes[lexem_type])
                             ] # this one is a list of identificator
            # initialize iterable
            zip_id_voc = zip_longest(
                identificators, vocabulary, 
                fillvalue=None
            )
            # create dict {identificator:word}
            for idt, voc in zip_id_voc:
                identificators_table[lexem_type][''.join(idt)] = voc

        # return all 
        return identificators_table, identificators_sizes
99541
def create(self):
        """"""
        body = dict()
        if self.mapping is not None:
            body['mappings'] = self.mapping
        if self.settings is not None:
            body['settings'] = self.settings
        else:
            body['settings'] = self._default_settings()
        self.instance.indices.create(self.index, body)
1050616
def add_sample(self, name, labels, value, timestamp=None, exemplar=None):
        """"""
        self.samples.append(Sample(name, labels, value, timestamp, exemplar))
798448
def build_string_table(measurements)
      common_tags = @registry.common_tags
      table = {}
      common_tags.each do |k, v|
        table[k] = 0
        table[v] = 0
      end
      table[:name] = 0
      measurements.each do |m|
        table[m.id.name] = 0
        m.id.tags.each do |k, v|
          table[k] = 0
          table[v] = 0
        end
      end
      keys = table.keys.sort
      keys.each_with_index do |str, index|
        table[str] = index
      end
      table
    end
871184
def create_or_open_table_at index
      t = self[index]
      t = self[index] = Workbook::Table.new if t == nil
      t.sheet = self
      t
    end
935968
def _init_table(self):
        
        self.observation_table.sm_vector.append(self.epsilon)
        self.observation_table.smi_vector = [random.choice(self.alphabet)]
        self.observation_table.em_vector.append(self.epsilon)

        self._fill_table_entry(self.epsilon, self.epsilon)
        for s in self.observation_table.smi_vector:
            self._fill_table_entry(s, self.epsilon)
1228015
def initialize(self):
        ''''''
        if es.indices.exists(self.index_name):
            es.indices.put_mapping(index=self.index_name, doc_type=DOCTYPE, body=MAPPING)
        else:
            es.indices.create(self.index_name, {
                'mappings': {'advice': MAPPING},
                'settings': {'analysis': ANALSYS},
            })
763662
def _init_table(self):
        
        self.observation_table.sm_vector.append(self.epsilon)
        self.observation_table.smi_vector = list(self.alphabet)
        self.observation_table.em_vector.append(self.epsilon)

        self._fill_table_entry(self.epsilon, self.epsilon)
        for s in self.observation_table.smi_vector:
            self._fill_table_entry(s, self.epsilon)
1143396
private void createIndexes(Table t) {
        for (String indexName : t.getIndexHoldersByName().keySet()) {
            if (!indexName.startsWith("PRIMARY")) {
                createIndex(t, t.getIndexHolderByName(indexName));
            }
        }
    }
871507
private void createIndex() {
        try {
            client.createIndex(name(), workspace, columns.mappings(workspace));
            client.flush(name());
        } catch (IOException e) {
            throw new EsIndexException(e);
        }
    }
659178
def create_schema(self):
        """"""
        cursor = self.cursor
        execute = cursor.execute
        execute('SHOW TABLES')
        tables = {table for table, in cursor}
        if 'gauged_data' not in tables:
            execute("""CREATE TABLE gauged_data (
                namespace INT(11) UNSIGNED NOT NULL,
                offset INT(11) UNSIGNED NOT NULL,
                `key` BIGINT(15) UNSIGNED NOT NULL,
                data MEDIUMBLOB NOT NULL,
                flags INT(11) UNSIGNED NOT NULL,
                PRIMARY KEY (offset, namespace, `key`))""")
        if 'gauged_keys' not in tables:
            execute("""CREATE TABLE gauged_keys (
                id BIGINT(15) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
                namespace INT(11) UNSIGNED NOT NULL,
                `key` VARCHAR(255) BINARY NOT NULL,
                UNIQUE KEY (namespace, `key`))""")
        if 'gauged_writer_history' not in tables:
            execute("""CREATE TABLE gauged_writer_history (
                id VARCHAR(255) NOT NULL PRIMARY KEY,
                timestamp BIGINT(15) UNSIGNED NOT NULL)""")
        if 'gauged_cache' not in tables:
            execute("""CREATE TABLE gauged_cache (
                namespace INT(11) UNSIGNED NOT NULL,
                `key` BIGINT(15) UNSIGNED NOT NULL,
                hash BINARY(20) NOT NULL,
                length BIGINT(15) UNSIGNED NOT NULL,
                start BIGINT(15) UNSIGNED NOT NULL,
                value FLOAT(11),
                PRIMARY KEY (namespace, hash, length, start))""")
        if 'gauged_statistics' not in tables:
            execute("""CREATE TABLE gauged_statistics (
                namespace INT(11) UNSIGNED NOT NULL,
                offset INT(11) UNSIGNED NOT NULL,
                data_points INT(11) UNSIGNED NOT NULL,
                byte_count INT(11) UNSIGNED NOT NULL,
                PRIMARY KEY (namespace, offset))""")
        if 'gauged_metadata' not in tables:
            execute("""CREATE TABLE gauged_metadata (
                `key` VARCHAR(255) NOT NULL PRIMARY KEY,
                value VARCHAR(255) NOT NULL)""")
        self.db.commit()
195745
private void growTable() {

        final int oldLength      = states.length;
        final int[] oldKeys      = keys;
        final float[] oldValues = values;
        final byte[] oldStates   = states;

        final int newLength = RESIZE_MULTIPLIER * oldLength;
        final int[] newKeys = new int[newLength];
        final float[] newValues = new float[newLength];
        final byte[] newStates = new byte[newLength];
        final int newMask = newLength - 1;
        for (int i = 0; i < oldLength; ++i) {
            if (oldStates[i] == FULL) {
                final int key = oldKeys[i];
                final int index = findInsertionIndex(newKeys, newStates, key, newMask);
                newKeys[index]   = key;
                newValues[index] = oldValues[i];
                newStates[index] = FULL;
            }
        }

        mask   = newMask;
        keys   = newKeys;
        values = newValues;
        states = newStates;

    }
83607
def create_index(column_names, unique=False):
    
    connection = _State.connection()
    _State.reflect_metadata()
    table_name = _State.table.name

    table = _State.table

    index_name = re.sub(r'[^a-zA-Z0-9]', '', table_name) + '_'
    index_name += '_'.join(re.sub(r'[^a-zA-Z0-9]', '', x)
                           for x in column_names)

    if unique:
        index_name += '_unique'

    columns = []
    for column_name in column_names:
        columns.append(table.columns[column_name])

    current_indices = [x.name for x in table.indexes]
    index = sqlalchemy.schema.Index(index_name, *columns, unique=unique)
    if index.name not in current_indices:
        index.create(bind=_State.engine)
481253
private void fillTableWithMatches(VariantGraphRanking ranking, VariantGraph graph, Iterable<Token> witness, Comparator<Token> comparator) {
        Matches matches = Matches.between(graph.vertices(), witness, comparator);
        Set<Token> unique = matches.uniqueInWitness;
        Set<Token> ambiguous = matches.ambiguousInWitness;
        int rowIndex = 0;
        for (Token t : witness) {
            if (unique.contains(t) || ambiguous.contains(t)) {
                List<VariantGraph.Vertex> matchingVertices = matches.allMatches.getOrDefault(t, Collections.emptyList());
                for (VariantGraph.Vertex vgv : matchingVertices) {
                    set(rowIndex, ranking.apply(vgv) - 1, t, vgv);
                }
            }
            rowIndex++;
        }
    }