Skip to content

LazyColumn.str.repeat

repeat

repeat(repeats: int) -> LazyColumn

Repeats each string in the column by the specified number of times.

Parameters:

Name Type Description Default
repeats int

Number of times to repeat each string.

required

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn with each string repeated repeats times.

Examples:

print(df.head())
#    col1 my_string_column
# 0     1         "abc"
# 1     2         "x"
# 2     3         None
# 3     4         ""

df["my_string_column"].str.repeat(3)
# ["abcabcabc", "xxx", None, ""]