Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 19 additions & 39 deletions third_party/bigframes_vendored/pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,12 @@ def strip(self, to_strip: typing.Optional[str] = None):
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> s = bpd.Series(['1. Ant.', ' 2. Bee? ', '\\t3. Cat!\\n', bpd.NA])
>>> s
0 1. Ant.
1 2. Bee?
2 3. Cat!
<BLANKLINE>
3 <NA>
dtype: string

>>> s = bpd.Series([
... '1. Ant.',
... ' 2. Bee? ',
... '\\t3. Cat!\\n',
... bpd.NA,
... ])
>>> s.str.strip()
0 1. Ant.
1 2. Bee?
Expand All @@ -269,10 +266,10 @@ def strip(self, to_strip: typing.Optional[str] = None):
dtype: string

>>> s.str.strip('123.!? \\n\\t')
0 Ant
1 Bee
2 Cat
3 <NA>
0 Ant
1 Bee
2 Cat
3 <NA>
dtype: string

Args:
Expand Down Expand Up @@ -543,7 +540,7 @@ def isdecimal(self):
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def rstrip(self, to_strip: typing.Optional[str] = None):
"""Remove trailing characters.
r"""Remove trailing characters.

Strip whitespaces (including newlines) or a set of specified characters
from each string in the Series/Index from right side.
Expand All @@ -555,19 +552,11 @@ def rstrip(self, to_strip: typing.Optional[str] = None):
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> s = bpd.Series(['Ant', ' Bee ', '\\tCat\\n', bpd.NA])
>>> s
0 Ant
1 Bee
2 Cat
<BLANKLINE>
3 <NA>
dtype: string

>>> s = bpd.Series(['Ant', ' Bee ', '\tCat\n', bpd.NA])
>>> s.str.rstrip()
0 Ant
1 Bee
2 Cat
2 \tCat
3 <NA>
dtype: string

Expand All @@ -584,7 +573,7 @@ def rstrip(self, to_strip: typing.Optional[str] = None):
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

def lstrip(self, to_strip: typing.Optional[str] = None):
"""Remove leading characters.
r"""Remove leading characters.

Strip whitespaces (including newlines) or a set of specified characters
from each string in the Series/Index from left side.
Expand All @@ -596,21 +585,12 @@ def lstrip(self, to_strip: typing.Optional[str] = None):
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None

>>> s = bpd.Series(['Ant', ' Bee ', '\\tCat\\n', bpd.NA])
>>> s
0 Ant
1 Bee
2 Cat
<BLANKLINE>
3 <NA>
dtype: string

>>> s = bpd.Series(['Ant', ' Bee ', '\tCat\n', bpd.NA])
>>> s.str.lstrip()
0 Ant
1 Bee
2 Cat
<BLANKLINE>
3 <NA>
0 Ant
1 Bee
2 Cat\n
3 <NA>
dtype: string

Args:
Expand Down