Skip to content

Commit 817b0c0

Browse files
docs: adjust strip method examples to match latest pandas (#1797)
The string representation of pandas Series has changed, causing doctest failures in `accessor.py`. This commit updates the expected output in the doctests for `lstrip`, `rstrip`, and `strip` to reflect the new string representation. The changes involve removing the `<BLANKLINE>` before `<NA>` and adjusting the spacing in the doctest examples. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 36bc179 commit 817b0c0

File tree

1 file changed

+19
-39
lines changed
  • third_party/bigframes_vendored/pandas/core/strings

1 file changed

+19
-39
lines changed

third_party/bigframes_vendored/pandas/core/strings/accessor.py

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,12 @@ def strip(self, to_strip: typing.Optional[str] = None):
252252
>>> import bigframes.pandas as bpd
253253
>>> bpd.options.display.progress_bar = None
254254
255-
>>> s = bpd.Series(['1. Ant.', ' 2. Bee? ', '\\t3. Cat!\\n', bpd.NA])
256-
>>> s
257-
0 1. Ant.
258-
1 2. Bee?
259-
2 3. Cat!
260-
<BLANKLINE>
261-
3 <NA>
262-
dtype: string
263-
255+
>>> s = bpd.Series([
256+
... '1. Ant.',
257+
... ' 2. Bee? ',
258+
... '\\t3. Cat!\\n',
259+
... bpd.NA,
260+
... ])
264261
>>> s.str.strip()
265262
0 1. Ant.
266263
1 2. Bee?
@@ -269,10 +266,10 @@ def strip(self, to_strip: typing.Optional[str] = None):
269266
dtype: string
270267
271268
>>> s.str.strip('123.!? \\n\\t')
272-
0 Ant
273-
1 Bee
274-
2 Cat
275-
3 <NA>
269+
0 Ant
270+
1 Bee
271+
2 Cat
272+
3 <NA>
276273
dtype: string
277274
278275
Args:
@@ -543,7 +540,7 @@ def isdecimal(self):
543540
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
544541

545542
def rstrip(self, to_strip: typing.Optional[str] = None):
546-
"""Remove trailing characters.
543+
r"""Remove trailing characters.
547544
548545
Strip whitespaces (including newlines) or a set of specified characters
549546
from each string in the Series/Index from right side.
@@ -555,19 +552,11 @@ def rstrip(self, to_strip: typing.Optional[str] = None):
555552
>>> import bigframes.pandas as bpd
556553
>>> bpd.options.display.progress_bar = None
557554
558-
>>> s = bpd.Series(['Ant', ' Bee ', '\\tCat\\n', bpd.NA])
559-
>>> s
560-
0 Ant
561-
1 Bee
562-
2 Cat
563-
<BLANKLINE>
564-
3 <NA>
565-
dtype: string
566-
555+
>>> s = bpd.Series(['Ant', ' Bee ', '\tCat\n', bpd.NA])
567556
>>> s.str.rstrip()
568557
0 Ant
569558
1 Bee
570-
2 Cat
559+
2 \tCat
571560
3 <NA>
572561
dtype: string
573562
@@ -584,7 +573,7 @@ def rstrip(self, to_strip: typing.Optional[str] = None):
584573
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
585574

586575
def lstrip(self, to_strip: typing.Optional[str] = None):
587-
"""Remove leading characters.
576+
r"""Remove leading characters.
588577
589578
Strip whitespaces (including newlines) or a set of specified characters
590579
from each string in the Series/Index from left side.
@@ -596,21 +585,12 @@ def lstrip(self, to_strip: typing.Optional[str] = None):
596585
>>> import bigframes.pandas as bpd
597586
>>> bpd.options.display.progress_bar = None
598587
599-
>>> s = bpd.Series(['Ant', ' Bee ', '\\tCat\\n', bpd.NA])
600-
>>> s
601-
0 Ant
602-
1 Bee
603-
2 Cat
604-
<BLANKLINE>
605-
3 <NA>
606-
dtype: string
607-
588+
>>> s = bpd.Series(['Ant', ' Bee ', '\tCat\n', bpd.NA])
608589
>>> s.str.lstrip()
609-
0 Ant
610-
1 Bee
611-
2 Cat
612-
<BLANKLINE>
613-
3 <NA>
590+
0 Ant
591+
1 Bee
592+
2 Cat\n
593+
3 <NA>
614594
dtype: string
615595
616596
Args:

0 commit comments

Comments
 (0)