polars.internals.series.string.StringNameSpace.decode#

StringNameSpace.decode(encoding: TransferEncoding, strict: bool = False) pli.Series[source]#

Decode a value using the provided encoding.

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

The encoding to use.

strict

How to handle invalid inputs:

  • True: An error will be thrown if unable to decode a value.

  • False: Unhandled values will be replaced with None.

Examples

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