polars.Series.str.n_chars#
- Series.str.n_chars() Series [source]#
Get length of the string values in the Series (as number of chars).
- Returns:
- Series
Series of data type
UInt32
.
Notes
If you know that you are working with ASCII text,
lengths
will be equivalent, and faster (returns length in terms of the number of bytes).Examples
>>> s = pl.Series(["Café", None, "345", "東京"]) >>> s.str.n_chars() shape: (4,) Series: '' [u32] [ 4 null 3 2 ]