polars.Series.bin.slice#

Series.bin.slice(offset: int, length: int | None = None) Series[source]#

Slice the binary values.

Parameters:
offset

Start index. Negative indexing is supported.

length

Length of the slice. If set to None (default), the slice is taken to the end of the value.

Returns:
Series

Series of data type Binary.

Examples

>>> colors = pl.Series([b"\x00\x00\x00", b"\xff\xff\x00", b"\x00\x00\xff"])
>>> colors.bin.slice(1, 2)
shape: (3,)
Series: '' [binary]
[
        b"\x00\x00"
        b"\xff\x00"
        b"\x00\xff"
]