polars.Series.bin.get#
- Series.bin.get(index: int | IntoExpr, *, null_on_oob: bool = False) Series[source]#
Get the byte value at the given index.
For example, index
0would return the first byte of every binary value and index-1would return the last byte of every binary value. The behavior if an index is out of bounds is determined by the argumentnull_on_oob.- Parameters:
- index
Index to return per binary value
- null_on_oob
Behavior if an index is out of bounds:
True -> set as null
False -> raise an error
Examples
>>> s = pl.Series("a", [b"\x01\x02\x03", b"", b"\x04\x05"]) >>> s.bin.get(0, null_on_oob=True) shape: (3,) Series: 'a' [u8] [ 1 null 4 ]