Skip to content

LazyColumn.str.startswith

startswith

startswith(prefix: str) -> LazyColumn

Checks whether each string starts with a given prefix.

Parameters:

Name Type Description Default
prefix str

The prefix to check for.

required

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn of boolean values indicating whether each string starts with prefix. Null entries remain null (or False depending on implementation).

Examples:

print(df.head())
#    col1 my_string_column
# 0     1          "Hello"
# 1     2          "HiWorld"
# 2     3          None
# 3     4          "Test"
# 4     5          "HelloTest"

df["my_string_column"].str.startswith("He")
# [True, False, None, False, True]