polars.Series.str.to_code_point#

Series.str.to_code_point() → Series[source]#

Get the Unicode code point of the first character of each string.

An empty string gives null.

See also

from_code_point

Examples

>>> s = pl.Series("s", ["A", "é", "€uro", "", None])
>>> s.str.to_code_point()
shape: (5,)
Series: 's' [u32]
[
    65
    233
    8364
    null
    null
]