polars.Series.str.encode#

Series.str.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 Utf8.

Examples

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