polars.internals.series.string.StringNameSpace.encode#

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

Encode a value using the provided encoding.

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

The encoding to use.

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
]