Strings#

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

Series.str.concat([delimiter])

Vertically concat the values in the Series to a single string value.

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

Check if strings in Series contain a substring that matches a regex.

Series.str.count_match(pattern)

Count all successive non-overlapping regex matches.

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

Decode a value using the provided encoding.

Series.str.encode(encoding)

Encode a value using the provided encoding.

Series.str.ends_with(sub)

Check if string values end with a substring.

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

Extract the target capture group from provided patterns.

Series.str.extract_all(pattern)

Extracts all matches for the given regex pattern.

Series.str.json_path_match(json_path)

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

Series.str.lengths()

Get length of the string values in the Series (as number of bytes).

Series.str.ljust(width[, fillchar])

Return the string left justified in a string of length width.

Series.str.lstrip([matches])

Remove leading whitespace.

Series.str.n_chars()

Get length of the string values in the Series (as number of chars).

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

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

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

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

Series.str.rjust(width[, fillchar])

Return the string right justified in a string of length width.

Series.str.rstrip([matches])

Remove trailing whitespace.

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

Create subslices of the string values of a Utf8 Series.

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(sub)

Check if string values start with a substring.

Series.str.strip([matches])

Remove leading and trailing whitespace.

Series.str.strptime(datatype[, fmt, strict, ...])

Parse a Series of dtype Utf8 to a Date/Datetime Series.

Series.str.to_lowercase()

Modify the strings to their lowercase equivalent.

Series.str.to_uppercase()

Modify the strings to their uppercase equivalent.

Series.str.zfill(alignment)

Fills the string with zeroes.