polars.Series.bin.encode#

Series.bin.encode(encoding: TransferEncoding) Series[source]#

Encode a value using the provided encoding.

Parameters:
encoding{‘hex’, ‘base64’}

The encoding to use.

Returns:
Series

Series of data type Boolean.

Examples

>>> s = pl.Series("colors", [b"\x00\x00\x00", b"\xff\xff\x00", b"\x00\x00\xff"])
>>> s.bin.encode("hex")
shape: (3,)
Series: 'colors' [str]
[
    "000000"
    "ffff00"
    "0000ff"
]
>>> s.bin.encode("base64")
shape: (3,)
Series: 'colors' [str]
[
    "AAAA"
    "//8A"
    "AAD/"
]