Skip to content

Expr.Bin (BinaryOps) ​

Namespace: Polars.FSharp

Instance Methods ​

Contains ​

Check if binaries in Series contain a binary substring.

fsharp
member Contains(literal: Expr) : Expr

Parameters

NameTypeDescription
literalExprThe binary substring to look for

Returns: Expression/Series of data type Boolean.


Decode ​

Decode values using the provided encoding.

fsharp
member Decode(encoding: TransferEncoding, ?strict: bool) : Expr

Parameters

NameTypeDescription
encodingTransferEncodingThe encoding to use.
strictbool (optional)Raise an error if the underlying value cannot be decoded, otherwise mask out with a null value.

Returns: Expression/Series of data type Binary.


Encode ​

Encode a value using the provided encoding.

fsharp
member Encode(encoding: TransferEncoding) : Expr

Parameters

NameTypeDescription
encodingTransferEncodingThe encoding to use.

Returns: Expression/Series of data type Binary.


EndsWith ​

Check if values start with a binary substring.

fsharp
member EndsWith(suffix: Expr) : Expr

Parameters

NameTypeDescription
suffixExprPrefix substring.

Returns: Expression/Series of data type Boolean.


Take the first n bytes of the binary values.

fsharp
member Head(?n: int) : Expr

Parameters

NameTypeDescription
nint (optional)Length of the slice (integer or expression). Negative indexing is supported

Returns: Expression/Series of data type Binary


Reinterpret ​

Interpret bytes as another type.Supported types are numerical or temporal dtypes, or an Array of these dtypes.

fsharp
member Reinterpret(dtype: DataTypeExpr, ?endianness: Endianness) : Expr
member Reinterpret(dtype: DataType, ?endianness: Endianness) : Expr

Parameters

NameTypeDescription
dtypeDataTypeExprWhich type to interpret binary column into.
endiannessEndianness (optional)Which endianness to use when interpreting bytes, by default “little”.

Returns: Expression/Series of data type dtype. Note that rows of the binary array where the length does not match the size in bytes of the output array (number of items * byte size of item) will become NULL.


Size ​

Computes the size of the binary data in the specified unit. The default unit is Bytes. Scaling to other units will result in a Float64 expression.

fsharp
member Size(?unit: SizeUnit) : Expr

Parameters

NameTypeDescription
unitSizeUnit (optional)The unit to scale the binary size to.

Returns: A new Polars Expression representing the scaled size.


Slice ​

Slice the binary values.

fsharp
member Slice(offset: int, ?length: int) : Expr

Parameters

NameTypeDescription
offsetintStart index. Negative indexing is supported.
lengthint (optional)Length of the slice. If set to None (default), the slice is taken to the end of the value.

Returns: Expression/Series of data type Binary.


StartsWith ​

Check if values start with a binary substring.

fsharp
member StartsWith(prefix: Expr) : Expr

Parameters

NameTypeDescription
prefixExprPrefix substring.

Returns: Expression/Series of data type Boolean.


Tail ​

Take the last n bytes of the binary values.

fsharp
member Tail(?n: int) : Expr

Parameters

NameTypeDescription
nint (optional)Length of the slice (integer or expression). Negative indexing is supported

Returns: Expression/Series of data type Binary


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