Documentation
¶
Overview ¶
Package selector picks a frame's columns by what they are, as Polars' selectors do: by type, by name, by place, and the unions, intersections, differences and complements of those (step 322). The set algebra is named, Union and Complement where Polars writes | and ~, so a selector's complement is never mistaken for an expression's negation.
lf.Select(selector.Numeric().Difference(selector.ByName("id")).Expr()) // every number but id
lf.WithColumns(selector.Float().Exclude("price").Expr().Round(2)) // each float but price, rounded
A selector is resolved against the frame's schema when the query is planned, so one written selector serves any schema. Each answers in the schema's order but ByName and ByIndex, which answer in the order written, as Polars' do; a combined selector answers in the schema's order. A selector that selects nothing selects nothing, as Polars': no error, but where a name or a place is asked for that the frame lacks.
Index ¶
- type Selector
- func All() Selector
- func Alpha() Selector
- func Alphanumeric() Selector
- func Array() Selector
- func Binary() Selector
- func Boolean() Selector
- func ByDType(types ...ursus.DataType) Selector
- func ByIndex(indices ...int) Selector
- func ByName(names ...string) Selector
- func Categorical() Selector
- func Contains(subs ...string) Selector
- func Date() Selector
- func Datetime() Selector
- func Decimal() Selector
- func Digit() Selector
- func Duration() Selector
- func Empty() Selector
- func EndsWith(suffixes ...string) Selector
- func Enum() Selector
- func First() Selector
- func Float() Selector
- func Integer() Selector
- func Last() Selector
- func List() Selector
- func Matches(pattern string) Selector
- func Nested() Selector
- func Numeric() Selector
- func SignedInteger() Selector
- func StartsWith(prefixes ...string) Selector
- func String() Selector
- func Struct() Selector
- func Temporal() Selector
- func Time() Selector
- func UnsignedInteger() Selector
- func (s Selector) Complement() Selector
- func (s Selector) Difference(o Selector) Selector
- func (s Selector) Exclude(names ...string) Selector
- func (s Selector) Expand(schema *ursus.Schema) ([]string, error)
- func (s Selector) Expr() ursus.Expr
- func (s Selector) Intersect(o Selector) Selector
- func (s Selector) String() string
- func (s Selector) SymmetricDifference(o Selector) Selector
- func (s Selector) Union(o Selector) Selector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
Selector is a choice of columns, resolved against a schema.
func Alpha ¶
func Alpha() Selector
Alpha is the columns whose name is letters alone, Digit digits alone and Alphanumeric either, any script's, as Polars' with ascii_only false.
func Alphanumeric ¶
func Alphanumeric() Selector
func ByIndex ¶
ByIndex is the columns at the places given, in that order, a negative place from the end; one past either end is an error. First and Last are the first and the last column.
func Categorical ¶
func Categorical() Selector
Categorical selects the Categorical columns, Polars' cs.categorical(), which String does not, as Polars' cs.string() does not by default. New in 0.6.7.
func Integer ¶
func Integer() Selector
Integer is the integer columns, SignedInteger the signed ones and UnsignedInteger the unsigned.
func List ¶
func List() Selector
List is the List columns, Array the Array ones, Struct the Struct ones, and Nested any of them. Array is new in 0.6.7.
func Matches ¶
Matches is the columns whose name the regular expression matches, anywhere in it, as Polars' matches; anchor it with ^ and $ for the whole name.
func Numeric ¶
func Numeric() Selector
Numeric is the columns of numbers: integers, floats and Decimals.
func SignedInteger ¶
func SignedInteger() Selector
func StartsWith ¶
StartsWith is the columns whose name starts with any of prefixes, EndsWith ends with any of suffixes, and Contains holds any of subs.
func String ¶
func String() Selector
String is the text columns, Binary the binary ones, Boolean the Boolean and Enum the Enum.
func Temporal ¶
func Temporal() Selector
Temporal is the columns of dates, instants, durations and times of day; Date, Datetime, Duration and Time each one kind, a Datetime of any unit and zone.
func UnsignedInteger ¶
func UnsignedInteger() Selector
func (Selector) Complement ¶
Complement is every column s does not select, Polars' ~ of a selector.
func (Selector) Difference ¶
Difference is the columns s selects and o does not, Polars' -.
func (Selector) Exclude ¶
Exclude is the columns s selects but the named ones, Polars' exclude: a name it does not select is passed over.
func (Selector) Expand ¶
Expand is the names s selects in schema, in the order the expression would make them, as Polars' expand_selector: an unknown name or place, or a pattern that does not compile, is an error.
func (Selector) Expr ¶
Expr is the selector as an expression, a column each selected column, where an expression goes: Select, WithColumns, Agg, or a method of Expr's.
func (Selector) SymmetricDifference ¶
SymmetricDifference is the columns one selects and the other does not, Polars' ^.