Skip to content

Selector ​

Namespace: Polars.CSharp

Represents a column selector strategy (e.g., All, Exclude). convertable to Expr.

Operators ​

operator + (Addition) ​

csharp
public static Expr operator +(Selector s, int other)
public static Expr operator +(Selector s, long other)
public static Expr operator +(Selector s, double other)
public static Expr operator +(Selector s, float other)
public static Expr operator +(Selector s, string v)
public static Expr operator +(int other, Selector s)
public static Expr operator +(long other, Selector s)
public static Expr operator +(double other, Selector s)
public static Expr operator +(float other, Selector s)
public static Expr operator +(string other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float / string-
vstring-

operator & (Bitwise / Logical AND) ​

csharp
public static Expr operator &(Selector s, bool v)
public static Expr operator &(bool v, Selector s)
public static Selector operator &(Selector left, Selector right)

Parameters

NameTypeDescription
sSelector-
vbool-
leftSelector-
rightSelector-

operator | (Bitwise / Logical OR) ​

csharp
public static Expr operator |(Selector s, bool v)
public static Expr operator |(bool v, Selector s)
public static Selector operator |(Selector left, Selector right)

Parameters

NameTypeDescription
sSelector-
vbool-
leftSelector-
rightSelector-

operator / (Division) ​

csharp
public static Expr operator /(Selector s, int other)
public static Expr operator /(Selector s, long other)
public static Expr operator /(Selector s, double other)
public static Expr operator /(Selector s, float other)
public static Expr operator /(int other, Selector s)
public static Expr operator /(long other, Selector s)
public static Expr operator /(double other, Selector s)
public static Expr operator /(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator == (Equality) ​

csharp
public static Expr operator ==(Selector s, int other)
public static Expr operator ==(Selector s, long other)
public static Expr operator ==(Selector s, double other)
public static Expr operator ==(Selector s, float other)
public static Expr operator ==(Selector s, string v)
public static Expr operator ==(int other, Selector s)
public static Expr operator ==(long other, Selector s)
public static Expr operator ==(double other, Selector s)
public static Expr operator ==(float other, Selector s)
public static Expr operator ==(string other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float / string-
vstring-

operator ^ (Exclusive OR) ​

csharp
public static Expr operator ^(Selector s, int v)
public static Expr operator ^(Selector s, long v)
public static Expr operator ^(Selector s, bool v)
public static Expr operator ^(int v, Selector s)
public static Expr operator ^(long v, Selector s)
public static Expr operator ^(bool v, Selector s)
public static Selector operator ^(Selector left, Selector right)

Parameters

NameTypeDescription
sSelector-
vint / long / bool-
leftSelector-
rightSelector-

operator > (Greater Than) ​

csharp
public static Expr operator >(Selector s, int other)
public static Expr operator >(Selector s, long other)
public static Expr operator >(Selector s, double other)
public static Expr operator >(Selector s, float other)
public static Expr operator >(int other, Selector s)
public static Expr operator >(long other, Selector s)
public static Expr operator >(double other, Selector s)
public static Expr operator >(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator >= (Greater Or Equal) ​

csharp
public static Expr operator >=(Selector s, int other)
public static Expr operator >=(Selector s, long other)
public static Expr operator >=(Selector s, double other)
public static Expr operator >=(Selector s, float other)
public static Expr operator >=(int other, Selector s)
public static Expr operator >=(long other, Selector s)
public static Expr operator >=(double other, Selector s)
public static Expr operator >=(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

implicit operator ​

Implicitly convert Selector to Expr. This is the magic that allows df.Select(Polars.All())

csharp
public static implicit operator Expr(Selector selector)

Parameters

NameTypeDescription
selectorSelector-

operator != (Inequality) ​

csharp
public static Expr operator !=(Selector s, int other)
public static Expr operator !=(Selector s, long other)
public static Expr operator !=(Selector s, double other)
public static Expr operator !=(Selector s, float other)
public static Expr operator !=(Selector s, string v)
public static Expr operator !=(int other, Selector s)
public static Expr operator !=(long other, Selector s)
public static Expr operator !=(double other, Selector s)
public static Expr operator !=(float other, Selector s)
public static Expr operator !=(string other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float / string-
vstring-

operator < (Less Than) ​

csharp
public static Expr operator <(Selector s, int other)
public static Expr operator <(Selector s, long other)
public static Expr operator <(Selector s, double other)
public static Expr operator <(Selector s, float other)
public static Expr operator <(int other, Selector s)
public static Expr operator <(long other, Selector s)
public static Expr operator <(double other, Selector s)
public static Expr operator <(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator <= (Less Or Equal) ​

csharp
public static Expr operator <=(Selector s, int other)
public static Expr operator <=(Selector s, long other)
public static Expr operator <=(Selector s, double other)
public static Expr operator <=(Selector s, float other)
public static Expr operator <=(int other, Selector s)
public static Expr operator <=(long other, Selector s)
public static Expr operator <=(double other, Selector s)
public static Expr operator <=(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator ! (Logical NOT) ​

csharp
public static Selector operator !(Selector s)

Parameters

NameTypeDescription
sSelector-

operator % (Modulus) ​

csharp
public static Expr operator %(Selector s, int other)
public static Expr operator %(Selector s, long other)
public static Expr operator %(Selector s, double other)
public static Expr operator %(Selector s, float other)
public static Expr operator %(int other, Selector s)
public static Expr operator %(long other, Selector s)
public static Expr operator %(double other, Selector s)
public static Expr operator %(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator * (Multiply) ​

csharp
public static Expr operator *(Selector s, int other)
public static Expr operator *(Selector s, long other)
public static Expr operator *(Selector s, double other)
public static Expr operator *(Selector s, float other)
public static Expr operator *(int other, Selector s)
public static Expr operator *(long other, Selector s)
public static Expr operator *(double other, Selector s)
public static Expr operator *(float other, Selector s)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-

operator ~ (Bitwise NOT) ​

csharp
public static Selector operator ~(Selector s)

Parameters

NameTypeDescription
sSelector-

operator - (Subtraction) ​

csharp
public static Expr operator -(Selector s, int other)
public static Expr operator -(Selector s, long other)
public static Expr operator -(Selector s, double other)
public static Expr operator -(Selector s, float other)
public static Expr operator -(int other, Selector s)
public static Expr operator -(long other, Selector s)
public static Expr operator -(double other, Selector s)
public static Expr operator -(float other, Selector s)
public static Selector operator -(Selector left, Selector right)

Parameters

NameTypeDescription
sSelector-
otherint / long / double / float-
leftSelector-
rightSelector-

Instance Methods ​

Clone ​

csharp
public Selector Clone()

Exclude ​

Exclude columns by name.

Exclude columns matching any of the specified Selectors. Usage: cs.Numeric().Exclude(cs.First(), cs.Last())

Exclude columns matching any of the specified Data Types. Usage: cs.All().Exclude(PlDataType.String, PlDataType.Boolean)

csharp
public Selector Exclude(params string[] names)
public Selector Exclude(ReadOnlySpan<Selector> selectors)
public Selector Exclude(ReadOnlySpan<DataType> dtypes)

Parameters

NameTypeDescription
namesstring[]-
selectorsReadOnlySpan<Selector>-
dtypesReadOnlySpan<DataType>-

ToExpr ​

Convert the selector to an Expression. This allows using selectors inside Select(), WithColumns(), etc.

csharp
public Expr ToExpr()

Released under the MIT License. Powered by the Polars Rust core & Apache Arrow.