Skip to content

LazyColumn.str.rstrip

rstrip

rstrip() -> LazyColumn

Strips whitespace from the right (trailing side) of the string.

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn with trailing whitespace removed.

Examples:

print(df.head())
#    col1 my_string_column
# 0     1         "abc   "
# 1     2         "def  "
# 2     3          None
# 3     4        "xyz  "
# 4     5        " hello   "

df["my_string_column"].str.rstrip()
# ["abc", "def", None, "xyz", " hello"]