Skip to content

string

StringMethods

StringMethods(series)

Class that provides string methods to series.

Parameters:

  • series (Series) –

    Series to be used.

len

len()

Return a series containing the length of each string.

Applies LEN operator to column.

Returns:

  • Series

    A series containing the length of each string.

lower

lower()

Return a series with all strings converted to lowercase.

Applies LOWER operator to column.

Returns:

  • Series

    A series with all strings converted to lowercase.

upper

upper()

Return a series with all strings converted to uppercase.

Applies UPPER operator to column.

Returns:

  • Series

    A series with all strings converted to uppercase.

lstrip

lstrip()

Return a series with leading whitespace removed from each string.

Applies LTRIM operator to column.

Returns:

  • Series

    A series with leading whitespace removed from each string.

rstrip

rstrip()

Return a series with trailing whitespace removed from each string.

Applies RTRIM operator to column.

Returns:

  • Series

    A series with trailing whitespace removed from each string.

strip

strip()

Return a series with leading and trailing whitespace removed from each string.

Applies RTRIM operator and LTRIM operator to column.

Returns:

  • Series

    A series with leading and trailing whitespace removed from each string.

startswith

startswith(pattern)

Return a boolean series indicating if each string starts with the specified pattern.

Applies LIKE operator to column.

Parameters:

  • pattern (str) –

    The string pattern to check.

Returns:

  • Series

    A boolean series indicating if each string starts with the specified pattern.

endswith

endswith(pattern)

Return a boolean series indicating if each string ends with the specified pattern.

Applies LIKE operator to column.

Parameters:

  • pattern (str) –

    The string pattern to check.

Returns:

  • Series

    A boolean series indicating if each string ends with the specified pattern.

contains

contains(pattern)

Return a boolean series indicating if the input pattern is contained in each string.

Applies LIKE operator to column.

Parameters:

  • pattern (str) –

    String pattern to search for.

Returns:

  • Series

    A boolean series indicating if the pattern is contained in each string.

replace

replace(to_replace, value)

Return a series with all occurrences of to_replace replaced by the replacement value.

Applies REPLACE operator to column.

Parameters:

Returns:

  • Series

    A series with all occurrences of search_pattern replaced by the replacement string.