String#

The following methods are available under the Series.str attribute.

Series.str.concat([delimiter, ignore_nulls])

Vertically concatenate the string values in the column to a single string value.

Series.str.contains(pattern, *[, literal, ...])

Check if the string contains a substring that matches a pattern.

Series.str.contains_any(patterns, *[, ...])

Use the Aho-Corasick algorithm to find matches.

Series.str.count_matches(pattern, *[, literal])

Count all successive non-overlapping regex matches.

Series.str.decode(encoding, *[, strict])

Decode values using the provided encoding.

Series.str.encode(encoding)

Encode a value using the provided encoding.

Series.str.ends_with(suffix)

Check if string values end with a substring.

Series.str.explode()

Returns a column with a separate row for every string character.

Series.str.extract(pattern[, group_index])

Extract the target capture group from provided patterns.

Series.str.extract_all(pattern)

Extract all matches for the given regex pattern.

Series.str.extract_groups(pattern)

Extract all capture groups for the given regex pattern.

Series.str.extract_many(patterns, *[, ...])

Use the Aho-Corasick algorithm to extract many matches.

Series.str.find(pattern, *[, literal, strict])

Return the index of the first substring in Series strings matching a pattern.

Series.str.head(n)

Return the first n characters of each string in a String Series.

Series.str.join([delimiter, ignore_nulls])

Vertically concatenate the string values in the column to a single string value.

Series.str.json_decode([dtype, ...])

Parse string values as JSON.

Series.str.json_path_match(json_path)

Extract the first match of json string with provided JSONPath expression.

Series.str.len_bytes()

Return the length of each string as the number of bytes.

Series.str.len_chars()

Return the length of each string as the number of characters.

Series.str.pad_end(length[, fill_char])

Pad the end of the string until it reaches the given length.

Series.str.pad_start(length[, fill_char])

Pad the start of the string until it reaches the given length.

Series.str.replace(pattern, value, *[, ...])

Replace first matching regex/literal substring with a new string value.

Series.str.replace_all(pattern, value, *[, ...])

Replace all matching regex/literal substrings with a new string value.

Series.str.replace_many(patterns[, ...])

Use the Aho-Corasick algorithm to replace many matches.

Series.str.reverse()

Returns string values in reversed order.

Series.str.slice(offset[, length])

Extract a substring from each string value.

Series.str.split(by, *[, inclusive])

Split the string by a substring.

Series.str.split_exact(by, n, *[, inclusive])

Split the string by a substring using n splits.

Series.str.splitn(by, n)

Split the string by a substring, restricted to returning at most n items.

Series.str.starts_with(prefix)

Check if string values start with a substring.

Series.str.strip_chars([characters])

Remove leading and trailing characters.

Series.str.strip_chars_start([characters])

Remove leading characters.

Series.str.strip_chars_end([characters])

Remove trailing characters.

Series.str.strip_prefix(prefix)

Remove prefix.

Series.str.strip_suffix(suffix)

Remove suffix.

Series.str.strptime(dtype[, format, strict, ...])

Convert a String column into a Date/Datetime/Time column.

Series.str.tail(n)

Return the last n characters of each string in a String Series.

Series.str.to_date([format, strict, exact, ...])

Convert a String column into a Date column.

Series.str.to_datetime([format, time_unit, ...])

Convert a String column into a Datetime column.

Series.str.to_decimal([inference_length])

Convert a String column into a Decimal column.

Series.str.to_integer(*[, base, strict])

Convert an String column into an Int64 column with base radix.

Series.str.to_lowercase()

Modify strings to their lowercase equivalent.

Series.str.to_time([format, strict, cache])

Convert a String column into a Time column.

Series.str.to_titlecase()

Modify strings to their titlecase equivalent.

Series.str.to_uppercase()

Modify strings to their uppercase equivalent.

Series.str.zfill(length)

Pad the start of the string with zeros until it reaches the given length.