xhochy / fletcher

Pandas ExtensionDType/Array backed by Apache Arrow

Home Page:https://fletcher.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add str.replace

xhochy opened this issue · comments

  • ✔️ pandas function
  • ✔️ Python function
  • ❌ C++ STL function
  • ❌ needs a regular expression library
  • ? maybe needs a Unicode database
  • ❌ cannot pre-compute output size

replace(…, regex=False) is a simpler case and can done without a regex library.

Pseudo-Code:

Inputs: pat, repl, n, case, regex

builder = StringBuilder()
for row in rows:
    if isnull(row)
        builder.addnull()
    else:
        if regex:
            builder.add(re.sub(pat, row, repl))
        else:
            builder.add(row.sub(pat, repl))