fletcher.string_array module

class fletcher.string_array.TextAccessor(obj)

Bases: fletcher.string_array.TextAccessorBase

Accessor for pandas exposed as .fr_strx.

Methods

cat(others)

Concatenate strings in the Series/Index with given separator.

contains(pat[, case, regex])

Test if pattern or regex is contained within a string of a Series or Index.

endswith(pat)

Check whether a row ends with a certain pattern.

replace(pat, repl[, n, case, regex])

Replace occurrences of pattern/regex in the Series/Index with some other string.

slice([start, end, step])

Extract every step character from strings from start to end.

startswith(pat)

Check whether a row starts with a certain pattern.

strip([to_strip])

Strip whitespaces from both ends of strings.

zfill(width)

Pad strings in the Series/Index by prepending ‘0’ characters.

count

isalnum

isalpha

isdecimal

isdigit

islower

isnumeric

isspace

istitle

isupper

cat(others: Optional[fletcher.base.FletcherBaseArray]) → pandas.core.series.Series

Concatenate strings in the Series/Index with given separator.

If others is specified, this function concatenates the Series/Index and elements of others element-wise. If others is not passed, then all values in the Series/Index are concatenated into a single string with a given sep.

contains(pat: str, case: bool = True, regex: bool = True) → pandas.core.series.Series

Test if pattern or regex is contained within a string of a Series or Index.

Return boolean Series or Index based on whether a given pattern or regex is contained within a string of a Series or Index.

This implementation differs to the one in pandas:
  • We always return a missing for missing data.

  • You cannot pass flags for the regular expression module.

Parameters
patstr

Character sequence or regular expression.

casebool, default True

If True, case sensitive.

regexbool, default True

If True, assumes the pat is a regular expression.

If False, treats the pat as a literal string.

Returns
Series or Index of boolean values

A Series or Index of boolean values indicating whether the given pattern is contained within the string of each element of the Series or Index.

count(pat: str, regex: bool = True) → pandas.core.series.Series
endswith(pat)

Check whether a row ends with a certain pattern.

isalnum()
isalpha()
isdecimal()
isdigit()
islower()
isnumeric()
isspace()
istitle()
isupper()
replace(pat: str, repl: str, n: int = - 1, case: bool = True, regex: bool = True)

Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to str.replace() or re.sub().

Return а string Series where in each row the occurrences of the given pattern or regex pat are replaced by repl.

This implementation differs to the one in pandas:
  • We always return a missing for missing data.

  • You cannot pass flags for the regular expression module.

Parameters
patstr

Character sequence or regular expression.

replstr

Replacement string.

nint

Number of replacements to make from start.

casebool, default True

If True, case sensitive.

regexbool, default True

If True, assumes the pat is a regular expression. If False, treats the pat as a literal string.

Returns
Series of string values.
slice(start=0, end=None, step=1)

Extract every step character from strings from start to end.

startswith(pat)

Check whether a row starts with a certain pattern.

strip(to_strip=None)

Strip whitespaces from both ends of strings.

zfill(width: int) → pandas.core.series.Series

Pad strings in the Series/Index by prepending ‘0’ characters.

class fletcher.string_array.TextAccessorBase(obj)

Bases: object

Base class for .fr_str and .fr_strx accessors.

class fletcher.string_array.TextAccessorExt(obj)

Bases: fletcher.string_array.TextAccessorBase

Accessor for pandas exposed as .fr_str.

fletcher.string_array.buffers_as_arrays(sa)