Selects next column indexes according to defined strategy

        Returns
        -------
        cols : ndarray((nsel,), dtype=int)
            selected columns
190446
def select(self):
        
        err = self._oasis_obj.error
        if np.allclose(err, 0):
            return None
        nsel = self._check_nsel()
        if nsel is None:
            return None
        return self._select(nsel, err)
445983
def iterative_select(obj, dimensions, selects, depth=None):
    
    ndims = len(dimensions)
    depth = depth if depth is not None else ndims
    items = []
    if isinstance(selects, dict):
        for k, v in selects.items():
            items += iterative_select(obj.select(**{dimensions[ndims-depth]: k}),
                                      dimensions, v, depth-1)
    else:
        for s in selects:
            items.append((s, obj.select(**{dimensions[-1]: s[-1]})))
    return items
435024
def iloc(cls, dataset, index):
        
        rows, cols = index
        scalar = False
        if isinstance(cols, slice):
            cols = [d.name for d in dataset.dimensions()][cols]
        elif np.isscalar(cols):
            scalar = np.isscalar(rows)
            cols = [dataset.get_dimension(cols).name]
        else:
            cols = [dataset.get_dimension(d).name for d in index[1]]
        if np.isscalar(rows):
            rows = [rows]

        data = OrderedDict()
        for c in cols:
            data[c] = dataset.data[c].compute().iloc[rows].values
        if scalar:
            return data[cols[0]][0]
        return tuple(data.values())
1213445
def get_column(self, col):
        
        # catch corner case with an empty file (group with no datasets)
        if not len(self.group.keys()):
            return np.array([])
        vals = self.group[col]
        if self.filter_func:
            return vals[self.mask]
        else:
            return vals[:]
1090400
def col(self, col_name_or_num):
        
        if isinstance(col_name_or_num, basestring):
            return self[col_name_or_num]
        elif isinstance(col_name_or_num, (int, long)):
            if col_name_or_num > len(self.fields):
                raise IndexError("Invalid column index `%s` for DataTable" %
                                 col_name_or_num)
            return self.__data[self.fields[col_name_or_num]]
982866
def keep(self, *cols):
        
        try:
            self.df = self.df[list(cols)]
        except Exception as e:
            self.err(e, "Can not remove colums")
            return
        self.ok("Setting dataframe to columns", " ".join(cols))
973182
def namedtuple_row_strategy(column_names):
    
    import collections
    # replace empty column names with placeholders
    column_names = [name if is_valid_identifier(name) else 'col%s_' % idx for idx, name in enumerate(column_names)]
    row_class = collections.namedtuple('Row', column_names)

    def row_factory(row):
        return row_class(*row)

    return row_factory
987723
def index(self, ref, columns):
        
        from ambry.orm.exc import NotFoundError

        logger.debug('Creating index for partition.\n    ref: {}, columns: {}'.format(ref, columns))

        connection = self._backend._get_connection()

        try:
            table_or_partition = self._library.partition(ref)
        except NotFoundError:
            table_or_partition = ref


        self._backend.index(connection, table_or_partition, columns)
599152
def select_models(clas,pool_or_cursor,**kwargs):
    ""
    if 'columns' in kwargs: raise ValueError("don't pass 'columns' to select_models")
    return (set_options(pool_or_cursor,clas(*row)) for row in clas.select(pool_or_cursor,**kwargs))
270469
Index getIndexForColumns(int[] cols) {

        int i = bestIndexForColumn[cols[0]];

        if (i > -1) {
            return indexList[i];
        }

        switch (tableType) {

            case TableBase.SYSTEM_SUBQUERY :
            case TableBase.SYSTEM_TABLE :
            case TableBase.VIEW_TABLE :
            case TableBase.TEMP_TABLE : {
                Index index = createIndexForColumns(cols);

                return index;
            }
        }

        return null;
    }
2077
def get_forward_returns_columns(columns):
    
    pattern = re.compile(r"^(\d+([Dhms]|ms|us|ns))+$", re.IGNORECASE)
    valid_columns = [(pattern.match(col) is not None) for col in columns]
    return columns[valid_columns]
415252
def create_column_index(annotations):
    
    _column_index = OrderedDict({'Column Name' : annotations['Column Name']})
    categorical_rows = annotation_rows('C:', annotations)
    _column_index.update(categorical_rows)
    numerical_rows = {name: [float(x) if x != '' else float('NaN') for x in values]
            for name, values in annotation_rows('N:', annotations).items()} # to floats
    _column_index.update(numerical_rows)
    column_index = pd.MultiIndex.from_tuples(list(zip(*_column_index.values())), names=list(_column_index.keys()))
    if len(column_index.names) == 1:
        # flatten single-level index
        name = column_index.names[0]
        column_index = column_index.get_level_values(name)
    return column_index
863029
def _get_select_columns(self, columns=None):
        
        if columns == ["*"] or columns is None:
            columns = ["%s.*" % self._related.get_table()]

        return columns + ["%s.%s" % (self._parent.get_table(), self._first_key)]
250762
def get_index_and_columns_order(cls, columns_in_file_expected, columns_dict, file_path):
        
        use_columns_with_index = []
        column_names_in_db = []

        column_names_from_file = cls.get_column_names_from_file(file_path)
        if not set(columns_in_file_expected).issubset(column_names_from_file):
            log.exception(
                '%s columns are not a subset of columns %s in file %s',
                columns_in_file_expected,
                column_names_from_file,
                file_path
            )
        else:
            for index, column in enumerate(column_names_from_file):
                if column in columns_dict:
                    use_columns_with_index.append(index)
                    column_names_in_db.append(columns_dict[column])
        return use_columns_with_index, column_names_in_db
77803
def columnOf(self, index):
        
        columns = self.columns()
        if ( 0 <= index and index < len(columns) ):
            return columns[index]
        return ''
1165519
def column( self, name ):
        
        columns = self.columns()
        if ( name in columns ):
            return columns.index(name)
        return -1
531419
def create_hypothetical_indexes_helper(columns_by_table, n, candidates)
      columns_by_table.each do |table, cols|
        # no reason to use btree index for json columns
        cols.reject { |c| ["json", "jsonb"].include?(c[:type]) }.permutation(n) do |col_set|
          candidates[col_set] = create_hypothetical_index(table, col_set)
        end
      end
    end