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.strip

xhochy opened this issue · comments

  • ✔️ pandas function
  • ✔️ Python function
  • ✔️ no need for a regular expression library
  • ✔️ no need for a Unicode database
  • ❌ cannot pre-compute output size

Pseudo-Code:

Inputs: to_strip

if to_strip is None:
    to_strip = list_of_whitespaces

builder = StringBuilder()
for row in rows:
    if isnull(row)
        builder.addnull()
    else:
        len = utf8_len(row)
        for i in range(len):
            if ut8_char(row, len - 1) in to_strip:
                len -= 1
            else:
                break
        builder.add(utf8_slice(row, 0, len))