polars.Series.bin.reinterpret#
- Series.bin.reinterpret(
- *,
- dtype: PolarsDataType,
- endianness: Endianness = 'little',
Interpret a buffer as a numerical polars type.
- Parameters:
- dtypePolarsDataType
Which type to interpret binary column into.
- endianness{“big”, “little”}, optional
Which endianness to use when interpreting bytes, by default “little”.
- Returns:
- Series
Series of data type
dtype
. Note that if binary array is too short value will be null. If binary array is too long, remainder will be ignored.
Examples
>>> s = pl.Series("data", [b"\x05\x00\x00\x00", b"\x10\x00\x01\x00"]) >>> s.bin.reinterpret(dtype=pl.Int32, endianness="little") shape: (2,) Series: 'data' [i32] [ 5 65552 ]