polars.Series.bin.head#
- Series.bin.head(n: int = 5) Series[source]#
Take the first
nbytes of the binary values.- Parameters:
- n
Length of the slice. Negative indexing is supported; see note (2) below.
- Returns:
- Series
Series of data type
Binary.
Notes
A similar method exists for taking the last
nbytes:tail().If
nis negative, it is interpreted as “until the nth byte from the end”, e.g.,head(-3)returns all but the last three bytes.
Examples
>>> colors = pl.Series([b"\x00\x00\x00", b"\xff\xff\x00", b"\x00\x00\xff"]) >>> colors.bin.head(2) shape: (3,) Series: '' [binary] [ b"\x00\x00" b"\xff\xff" b"\x00\x00" ]