This function tries to guess the columns to show from the given data
if [[columns]] are not explicitly specified.
340685
protected function guessColumns()
    {
        $models = $this->dataProvider->getModels();
        $model = reset($models);
        if (is_array($model) || is_object($model)) {
            foreach ($model as $name => $value) {
                $this->columns[] = $name;
            }
        }
    }
345286
def _setup_from_data(self, data):
        

        fitted_state = {}

        _raise_error_if_not_of_type(data, [_SFrame])

        feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)

        if not feature_columns:
            raise RuntimeError("No valid feature columns specified in transformation.")

        fitted_state["features"] = feature_columns

        ################################################################################
        # Helper functions

        def get_valid_interpretations():
            return list(n.split("__")[0] for n in dir(_interpretations) if not n.startswith("_"))

        ################################################################################
        # Check input data.

        if not isinstance(data, _SFrame):
            raise TypeError("`data` parameter must be an SFrame.")

        all_col_names = set(feature_columns)

        column_interpretations = self._get("column_interpretations").copy()

        # Make sure all the interpretations are valid.
        for k, v in column_interpretations.items():
            if k not in all_col_names:
                raise ValueError("Column '%s' in column_interpretations, but not found in `data`." % k)

        # Get the automatic column interpretations.
        for col_name in feature_columns:
            if col_name not in column_interpretations:
                n = column_interpretations[col_name] = infer_column_interpretation(data[col_name])

                if n.startswith("unknown"):
                    raise ValueError("Interpretation inference failed on column '%s'; %s"
                                     % (col_name, n[len("unknown"):].strip()))

        # Now, build up the feature transforms.
        transforms = {}
        input_types = {}

        output_column_prefix = self._get("output_column_prefix")

        assert output_column_prefix is None or type(output_column_prefix) is str

        tr_chain = []
        for col_name in feature_columns:
            in_type = input_types[col_name] = data[col_name].dtype

            intr_func = _get_interpretation_function(column_interpretations[col_name], in_type)
            tr_list = intr_func(col_name, output_column_prefix)
            transforms[col_name] = tr_list
            tr_chain += tr_list

        fitted_state["transform_chain"] = _TransformerChain(tr_chain)
        fitted_state["transforms"] = transforms
        fitted_state["input_types"] = input_types

        fitted_state["column_interpretations"] = column_interpretations

        self.__proxy__.update(fitted_state)
384909
def visibleCols(self):  # non-hidden cols
        ''
        return self.keyCols + [c for c in self.columns if not c.hidden and not c.keycol]
912106
def predict(self, test_data, **kwargs):
        
        if test_data.shape[1]!=self.data.shape[1]:
            raise Exception("Test data has different number of columns than training data.")
        for i in xrange(0,test_data.shape[1]):
            test_data.loc[:,i] = test_data.icol(i) - self.column_means[i]
            if int(self.column_stdevs[i])!=0:
                test_data.loc[:,i] = test_data.icol(i) / self.column_stdevs[i]
        return test_data
1168360
def table_from_data(data, column_names):
    ""

    # The agate table is generated from a list of dicts, so the column order
    # from `data` is not preserved. We can use `select` to reorder the columns
    #
    # If there is no data, create an empty table with the specified columns

    if len(data) == 0:
        return agate.Table([], column_names=column_names)
    else:
        table = agate.Table.from_object(data, column_types=DEFAULT_TYPE_TESTER)
        return table.select(column_names)
870300
def columns_are_indexed(self, columns):
        
        for index in self._indexes.values():
            if index.spans_columns(columns):
                return True

        return False
53585
def calculate_columns(sequence):
    
    columns = {}

    for row in sequence:
        for key in row.keys():
            if key not in columns:
                columns[key] = len(key)

            value_length = len(str(row[key]))
            if value_length > columns[key]:
                columns[key] = value_length

    return columns
164777
def itake_column(list_, colx):
    
    if isinstance(colx, list):
        # multi select
        return ([row[colx_] for colx_ in colx] for row in list_)
    else:
        return (row[colx] for row in list_)
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[:]
98622
def __parseColumns(self):
        """"""
        columns = []
        if self.__dataItem.has_key('columnModel'):
            for column in self.__dataItem['columnModel']:
                columns.append(Column(column))
        return columns
544153
function getMissingColumnCheck(expectedHeader, caseSensitive, severity) {

	return function (content) {
		let actualHeader;
		if (caseSensitive) {
			actualHeader = content;
		} else {
			actualHeader = arrayToUpperCase(content);
			expectedHeader = arrayToUpperCase(expectedHeader);
		}

		// the header must have all the expected columns but may have more
		let err = _missingColumns(expectedHeader, actualHeader);
		if (err) {
			return {
				errorCode: 'CHECK_HEADER_MISSING_COLUMNS',
				severity: severity,
				message: 'The following columns are missing in the header: [' + err.join() + ']'
			};
		}
	};
}
304124
def select(self, columns=(), by=(), where=(), **kwds):
        
        return self._seu('select', columns, by, where, kwds)
1121885
def extract_columns(rows, header)
      columns = []
      header.each do |h|
        columns << rows.map do |r|
          r.send(h)
        end  
      end
      columns
    end
81986
def columns(self, model=None):
        
        column = self.column(model=model)
        if column:
            yield column

        check = self.__value
        if not isinstance(check, (list, set, tuple)):
            check = (check,)

        for val in check:
            if isinstance(val, (Query, QueryCompound)):
                for col in val.columns(model):
                    yield col
736960
def to_smart_columns(data, headers=None, padding=2):
    
    result = ''
    col_widths = []
    for row in data:
        col_counter = 0
        for word in row:
            try:
                col_widths[col_counter] = max(len(word), col_widths[col_counter])
            except IndexError:
                col_widths.append(len(word))
            col_counter += 1

    if headers:
        col_counter = 0
        for word in headers:
            try:
                col_widths[col_counter] = max(len(word), col_widths[col_counter])
            except IndexError:
                col_widths.append(len(word))
            col_counter += 1

    # Add padding
    col_widths = [width + padding for width in col_widths]
    total_width = sum(col_widths)

    if headers:
        col_counter = 0
        for word in headers:
            result += "".join(word.ljust(col_widths[col_counter]))
            col_counter += 1
        result += "\n"
        result += '-' * total_width + "\n"

    for row in data:
        col_counter = 0
        for word in row:
            result += "".join(word.ljust(col_widths[col_counter]))
            col_counter += 1
        result += "\n"
    return result
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
84064
def read_with_columns(func):
    
    def wrapper(*args, **kwargs):
        # parse columns argument
        columns = kwargs.pop("columns", None)

        # read table
        tab = func(*args, **kwargs)

        # filter on columns
        if columns is None:
            return tab
        return tab[columns]

    return _safe_wraps(wrapper, func)