polars.internals.series.StringNameSpace.encode

StringNameSpace.encode(encoding: str) polars.internals.series.Series

Encodes a value using the provided encoding

Parameters
encoding

‘hex’ or ‘base64’

Returns
Utf8 array with values encoded using provided encoding

Examples

>>> s = pl.Series(["foo", "bar", None])
>>> s.str.encode("hex")
shape: (3,)
Series: '' [str]
[
    "666f6f"
    "626172"
    null
]