// SelectColumns returns only columns matching names.
SelectColumns returns only columns matching names.
// SelectColumns returns only columns matching names .
func (df *DataFrame) SelectColumns(names ...string) []array.Column {
	if len(names) == 0 {
		return []array.Column{}
	}
	set := make(map[string]struct{}, len(names))
	for _, name := range names {
		set[name] = struct{}{}
	}
	cols := make([]array.Column, 0, len(names))
	dfColumns := df.Columns()
	for i := range dfColumns {
		if _, ok := set[dfColumns[i].Name()]; !ok {
			continue
		}
		cols = append(cols, dfColumns[i])
	}
	return cols[:len(cols):len(cols)]
}
func ( df * DataFrame ) SelectColumns ( names ... string ) [ ] array . Column { if len ( names ) == 0 { return [ ] array . Column { } } set := make ( map [ string ] struct { } , len ( names ) ) for _ , name := range names { set [ name ] = struct { } { } } cols := make ( [ ] array . Column , 0 , len ( names ) ) dfColumns := df . Columns ( ) for i := range dfColumns { if _ , ok := set [ dfColumns [ i ] . Name ( ) ] ; ! ok { continue } cols = append ( cols , dfColumns [ i ] ) } return cols [ : len ( cols ) : len ( cols ) ] }
SelectColumns returns only columns matching names.
SelectColumns returns only columns matching names .