Skip to content

Commit d5e445e

Browse files
TomAugspurgerjreback
authored andcommitted
DOC: Fix the string example. (#30762)
1 parent e0f8340 commit d5e445e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/source/user_guide/text.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ l. For ``StringDtype``, :ref:`string accessor methods<api.series.str>`
8787

8888
.. ipython:: python
8989
90-
s.astype(object).str.count("a")
91-
s.astype(object).dropna().str.count("a")
90+
s2 = pd.Series(["a", None, "b"], dtype="object")
91+
s2.str.count("a")
92+
s2.dropna().str.count("a")
9293
9394
When NA values are present, the output dtype is float64. Similarly for
9495
methods returning boolean values.

0 commit comments

Comments
 (0)