From 48849a1959ed834c024cc570fe73b5ca02db04ae Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 6 Jan 2020 16:39:07 -0600 Subject: [PATCH] DOC: Fix the string example. After moving StringArray to use pd.NA `.astype(object)` had NA instead of NaN, so the output was object rather than float. --- doc/source/user_guide/text.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/user_guide/text.rst b/doc/source/user_guide/text.rst index 7a8400d124b22..88c86ac212f11 100644 --- a/doc/source/user_guide/text.rst +++ b/doc/source/user_guide/text.rst @@ -87,8 +87,9 @@ l. For ``StringDtype``, :ref:`string accessor methods` .. ipython:: python - s.astype(object).str.count("a") - s.astype(object).dropna().str.count("a") + s2 = pd.Series(["a", None, "b"], dtype="object") + s2.str.count("a") + s2.dropna().str.count("a") When NA values are present, the output dtype is float64. Similarly for methods returning boolean values.