Skip to content

LazyColumn.str.len

len

len() -> LazyColumn

Returns the length of each string.

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn of integer values representing the length of each string. Null entries remain null.

Examples:

print(df.head())
#    col1 my_string_column
# 0     1          "Hello"
# 1     2           None
# 2     3       "Test test"
# 3     4         "12345"
# 4     5       "   xyz  "

df["my_string_column"].str.len()
# [5, None, 9, 5, 7]