From fe4ea7eac7047b3e35468c666af63387c8a2343d Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 14:04:15 +0530 Subject: [PATCH 1/7] DOC: Standardize and expand docstring for BooleanDtype (fixes #61939) --- pandas/core/arrays/boolean.py | 46 ++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index 298e5ddb049ec..3e9607ee1f216 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -41,30 +41,58 @@ @register_extension_dtype class BooleanDtype(BaseMaskedDtype): """ - Extension dtype for boolean data. + Extension dtype for boolean data, with support for missing values. + + BooleanDtype is used to represent boolean data (True/False) with the ability to handle missing (NA) values through pandas' extension dtype system. This allows for efficient storage, computation, and interoperability with nullable boolean arrays in pandas objects. .. warning:: - BooleanDtype is considered experimental. The implementation and - parts of the API may change without warning. + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. Attributes ---------- - None - - Methods - ------- - None + name : str + String identifying the dtype ('boolean'). + na_value : pandas.NA + The scalar missing value used for this dtype. + kind : str + The kind of data ('b' for boolean). + numpy_dtype : numpy.dtype + The underlying NumPy dtype used ('bool'). + type : type + The scalar type for elements of this dtype (np.bool_). See Also -------- + BooleanArray : Extension array for boolean data with missing values. StringDtype : Extension dtype for string data. + array : Create a pandas array with a specific dtype. + Series : One-dimensional ndarray with axis labels. + DataFrame : Two-dimensional, size-mutable, tabular data. Examples -------- + Create a Series with BooleanDtype: + + >>> import pandas as pd + >>> s = pd.Series([True, False, None], dtype='boolean') + >>> s + 0 True + 1 False + 2 + dtype: boolean + + You can construct BooleanDtype directly: + >>> pd.BooleanDtype() BooleanDtype - """ + + Check that a Series has BooleanDtype: + + >>> s.dtype + BooleanDtype +""" name: ClassVar[str] = "boolean" From aa727c6383cece1ab25bf374753a4b0a3480568f Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 14:14:30 +0530 Subject: [PATCH 2/7] DOC: Fix line length in BooleanDtype docstring --- pandas/core/arrays/boolean.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index 3e9607ee1f216..0c27ff60c4742 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -43,7 +43,10 @@ class BooleanDtype(BaseMaskedDtype): """ Extension dtype for boolean data, with support for missing values. - BooleanDtype is used to represent boolean data (True/False) with the ability to handle missing (NA) values through pandas' extension dtype system. This allows for efficient storage, computation, and interoperability with nullable boolean arrays in pandas objects. + BooleanDtype is used to represent boolean data (True/False), with the ability to + handle missing (NA) values through pandas' extension dtype system. This allows + for efficient storage, computation, and interoperability with nullable boolean + arrays in pandas objects. .. warning:: From 02bef66d434d91de9b585954a4f62ad798334f2a Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 15:05:29 +0530 Subject: [PATCH 3/7] DOC: Fix warning directive and adjust BooleanDtype docstring attributes (fixes #61939) --- pandas/core/arrays/boolean.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index 0c27ff60c4742..b3eb85c1fc63c 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -50,15 +50,13 @@ class BooleanDtype(BaseMaskedDtype): .. warning:: - BooleanDtype is considered experimental. The implementation and - parts of the API may change without warning. + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. Attributes ---------- name : str String identifying the dtype ('boolean'). - na_value : pandas.NA - The scalar missing value used for this dtype. kind : str The kind of data ('b' for boolean). numpy_dtype : numpy.dtype @@ -66,6 +64,7 @@ class BooleanDtype(BaseMaskedDtype): type : type The scalar type for elements of this dtype (np.bool_). + See Also -------- BooleanArray : Extension array for boolean data with missing values. @@ -74,7 +73,7 @@ class BooleanDtype(BaseMaskedDtype): Series : One-dimensional ndarray with axis labels. DataFrame : Two-dimensional, size-mutable, tabular data. - Examples + Examples -------- Create a Series with BooleanDtype: From 4f916f3efa4568552d4983ba77b18b3aa3d07283 Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 15:24:19 +0530 Subject: [PATCH 4/7] DOC: Fix warning directive and adjust BooleanDtype docstring attributes (fixes #61939) --- pandas/core/arrays/boolean.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index b3eb85c1fc63c..533eee78e40b8 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -77,7 +77,6 @@ class BooleanDtype(BaseMaskedDtype): -------- Create a Series with BooleanDtype: - >>> import pandas as pd >>> s = pd.Series([True, False, None], dtype='boolean') >>> s 0 True From e6218670a390d8f264081a91c9e86c61504576a2 Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 15:26:56 +0530 Subject: [PATCH 5/7] DOC: Fix warning directive and adjust BooleanDtype docstring attributes (fixes #61939) --- pandas/core/arrays/boolean.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index 533eee78e40b8..a5f711f8e116f 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -50,8 +50,8 @@ class BooleanDtype(BaseMaskedDtype): .. warning:: - BooleanDtype is considered experimental. The implementation and - parts of the API may change without warning. + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. Attributes ---------- From e5ec311509916ebadf2e3facb5d0e7e6267d89ae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 11:39:24 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/core/arrays/boolean.py | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index a5f711f8e116f..e944e1172f478 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -41,59 +41,59 @@ @register_extension_dtype class BooleanDtype(BaseMaskedDtype): """ - Extension dtype for boolean data, with support for missing values. + Extension dtype for boolean data, with support for missing values. + + BooleanDtype is used to represent boolean data (True/False), with the ability to + handle missing (NA) values through pandas' extension dtype system. This allows + for efficient storage, computation, and interoperability with nullable boolean + arrays in pandas objects. + + .. warning:: + + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. + + Attributes + ---------- + name : str + String identifying the dtype ('boolean'). + kind : str + The kind of data ('b' for boolean). + numpy_dtype : numpy.dtype + The underlying NumPy dtype used ('bool'). + type : type + The scalar type for elements of this dtype (np.bool_). + + + See Also + -------- + BooleanArray : Extension array for boolean data with missing values. + StringDtype : Extension dtype for string data. + array : Create a pandas array with a specific dtype. + Series : One-dimensional ndarray with axis labels. + DataFrame : Two-dimensional, size-mutable, tabular data. - BooleanDtype is used to represent boolean data (True/False), with the ability to - handle missing (NA) values through pandas' extension dtype system. This allows - for efficient storage, computation, and interoperability with nullable boolean - arrays in pandas objects. - - .. warning:: - - BooleanDtype is considered experimental. The implementation and - parts of the API may change without warning. - - Attributes - ---------- - name : str - String identifying the dtype ('boolean'). - kind : str - The kind of data ('b' for boolean). - numpy_dtype : numpy.dtype - The underlying NumPy dtype used ('bool'). - type : type - The scalar type for elements of this dtype (np.bool_). - - - See Also - -------- - BooleanArray : Extension array for boolean data with missing values. - StringDtype : Extension dtype for string data. - array : Create a pandas array with a specific dtype. - Series : One-dimensional ndarray with axis labels. - DataFrame : Two-dimensional, size-mutable, tabular data. - - Examples - -------- - Create a Series with BooleanDtype: + Examples + -------- + Create a Series with BooleanDtype: - >>> s = pd.Series([True, False, None], dtype='boolean') - >>> s - 0 True - 1 False - 2 - dtype: boolean + >>> s = pd.Series([True, False, None], dtype="boolean") + >>> s + 0 True + 1 False + 2 + dtype: boolean - You can construct BooleanDtype directly: + You can construct BooleanDtype directly: - >>> pd.BooleanDtype() - BooleanDtype + >>> pd.BooleanDtype() + BooleanDtype - Check that a Series has BooleanDtype: + Check that a Series has BooleanDtype: - >>> s.dtype - BooleanDtype -""" + >>> s.dtype + BooleanDtype + """ name: ClassVar[str] = "boolean" From 7a3207f26892ce5fc0d366514dc5ffaf7ba4f164 Mon Sep 17 00:00:00 2001 From: Poorvi Singh Date: Mon, 8 Sep 2025 15:05:29 +0530 Subject: [PATCH 7/7] DOC: Fix warning directive and adjust BooleanDtype docstring attributes (fixes #61939) --- pandas/core/arrays/boolean.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index e944e1172f478..6abeec54c8f2c 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -49,9 +49,8 @@ class BooleanDtype(BaseMaskedDtype): arrays in pandas objects. .. warning:: - - BooleanDtype is considered experimental. The implementation and - parts of the API may change without warning. + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. Attributes ---------- @@ -76,6 +75,33 @@ class BooleanDtype(BaseMaskedDtype): Examples -------- Create a Series with BooleanDtype: +======= + BooleanDtype is considered experimental. The implementation and + parts of the API may change without warning. + + Attributes + ---------- + name : str + String identifying the dtype ('boolean'). + kind : str + The kind of data ('b' for boolean). + numpy_dtype : numpy.dtype + The underlying NumPy dtype used ('bool'). + type : type + The scalar type for elements of this dtype (np.bool_). + + + See Also + -------- + BooleanArray : Extension array for boolean data with missing values. + StringDtype : Extension dtype for string data. + array : Create a pandas array with a specific dtype. + Series : One-dimensional ndarray with axis labels. + DataFrame : Two-dimensional, size-mutable, tabular data. + + Examples + -------- + Create a Series with BooleanDtype: >>> s = pd.Series([True, False, None], dtype="boolean") >>> s