From 11f11aacd6e164eb73e5056ce138349e2132bbdd Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Tue, 7 Feb 2023 16:02:48 +0000 Subject: [PATCH 1/2] DOC: suppress deprecation messages in doc tests in Index.is_* --- pandas/core/indexes/base.py | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ed2e3a7499728..22bcbbd0d16d6 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2267,16 +2267,16 @@ def is_boolean(self) -> bool: Examples -------- - >>> idx = pd.Index([True, False, True]) - >>> idx.is_boolean() + >> idx = pd.Index([True, False, True]) + >> idx.is_boolean() # doctest: +SKIP True >>> idx = pd.Index(["True", "False", "True"]) - >>> idx.is_boolean() + >>> idx.is_boolean() # doctest: +SKIP False >>> idx = pd.Index([True, False, "True"]) - >>> idx.is_boolean() + >>> idx.is_boolean() # doctest: +SKIP False """ warnings.warn( @@ -2312,15 +2312,15 @@ def is_integer(self) -> bool: Examples -------- >>> idx = pd.Index([1, 2, 3, 4]) - >>> idx.is_integer() + >>> idx.is_integer() # doctest: +SKIP True >>> idx = pd.Index([1.0, 2.0, 3.0, 4.0]) - >>> idx.is_integer() + >>> idx.is_integer() # doctest: +SKIP False >>> idx = pd.Index(["Apple", "Mango", "Watermelon"]) - >>> idx.is_integer() + >>> idx.is_integer() # doctest: +SKIP False """ warnings.warn( @@ -2360,19 +2360,19 @@ def is_floating(self) -> bool: Examples -------- >>> idx = pd.Index([1.0, 2.0, 3.0, 4.0]) - >>> idx.is_floating() + >>> idx.is_floating() # doctest: +SKIP True >>> idx = pd.Index([1.0, 2.0, np.nan, 4.0]) - >>> idx.is_floating() + >>> idx.is_floating() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4, np.nan]) - >>> idx.is_floating() + >>> idx.is_floating() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4]) - >>> idx.is_floating() + >>> idx.is_floating() # doctest: +SKIP False """ warnings.warn( @@ -2408,23 +2408,23 @@ def is_numeric(self) -> bool: Examples -------- >>> idx = pd.Index([1.0, 2.0, 3.0, 4.0]) - >>> idx.is_numeric() + >>> idx.is_numeric() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4.0]) - >>> idx.is_numeric() + >>> idx.is_numeric() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4]) - >>> idx.is_numeric() + >>> idx.is_numeric() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4.0, np.nan]) - >>> idx.is_numeric() + >>> idx.is_numeric() # doctest: +SKIP True >>> idx = pd.Index([1, 2, 3, 4.0, np.nan, "Apple"]) - >>> idx.is_numeric() + >>> idx.is_numeric() # doctest: +SKIP False """ warnings.warn( @@ -2460,20 +2460,20 @@ def is_object(self) -> bool: Examples -------- >>> idx = pd.Index(["Apple", "Mango", "Watermelon"]) - >>> idx.is_object() + >>> idx.is_object() # doctest: +SKIP True >>> idx = pd.Index(["Apple", "Mango", 2.0]) - >>> idx.is_object() + >>> idx.is_object() # doctest: +SKIP True >>> idx = pd.Index(["Watermelon", "Orange", "Apple", ... "Watermelon"]).astype("category") - >>> idx.is_object() + >>> idx.is_object() # doctest: +SKIP False >>> idx = pd.Index([1.0, 2.0, 3.0, 4.0]) - >>> idx.is_object() + >>> idx.is_object() # doctest: +SKIP False """ warnings.warn( @@ -2511,11 +2511,11 @@ def is_categorical(self) -> bool: -------- >>> idx = pd.Index(["Watermelon", "Orange", "Apple", ... "Watermelon"]).astype("category") - >>> idx.is_categorical() + >>> idx.is_categorical() # doctest: +SKIP True >>> idx = pd.Index([1, 3, 5, 7]) - >>> idx.is_categorical() + >>> idx.is_categorical() # doctest: +SKIP False >>> s = pd.Series(["Peter", "Victor", "Elisabeth", "Mar"]) @@ -2525,7 +2525,7 @@ def is_categorical(self) -> bool: 2 Elisabeth 3 Mar dtype: object - >>> s.index.is_categorical() + >>> s.index.is_categorical() # doctest: +SKIP False """ warnings.warn( @@ -2564,11 +2564,11 @@ def is_interval(self) -> bool: -------- >>> idx = pd.Index([pd.Interval(left=0, right=5), ... pd.Interval(left=5, right=10)]) - >>> idx.is_interval() + >>> idx.is_interval() # doctest: +SKIP True >>> idx = pd.Index([1, 3, 5, 7]) - >>> idx.is_interval() + >>> idx.is_interval() # doctest: +SKIP False """ warnings.warn( From a0fe83aa0de08b8a62a565cafbf47fd4772f65ed Mon Sep 17 00:00:00 2001 From: Terji Petersen Date: Tue, 7 Feb 2023 18:14:34 +0000 Subject: [PATCH 2/2] DOC: fix issue --- pandas/core/indexes/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 22bcbbd0d16d6..de3e1028f5f00 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2267,8 +2267,8 @@ def is_boolean(self) -> bool: Examples -------- - >> idx = pd.Index([True, False, True]) - >> idx.is_boolean() # doctest: +SKIP + >>> idx = pd.Index([True, False, True]) + >>> idx.is_boolean() # doctest: +SKIP True >>> idx = pd.Index(["True", "False", "True"])