|
41 | 41 | @register_extension_dtype |
42 | 42 | class BooleanDtype(BaseMaskedDtype): |
43 | 43 | """ |
44 | | - Extension dtype for boolean data, with support for missing values. |
| 44 | + Extension dtype for boolean data, with support for missing values. |
| 45 | +
|
| 46 | + BooleanDtype is used to represent boolean data (True/False), with the ability to |
| 47 | + handle missing (NA) values through pandas' extension dtype system. This allows |
| 48 | + for efficient storage, computation, and interoperability with nullable boolean |
| 49 | + arrays in pandas objects. |
| 50 | +
|
| 51 | + .. warning:: |
| 52 | +
|
| 53 | + BooleanDtype is considered experimental. The implementation and |
| 54 | + parts of the API may change without warning. |
| 55 | +
|
| 56 | + Attributes |
| 57 | + ---------- |
| 58 | + name : str |
| 59 | + String identifying the dtype ('boolean'). |
| 60 | + kind : str |
| 61 | + The kind of data ('b' for boolean). |
| 62 | + numpy_dtype : numpy.dtype |
| 63 | + The underlying NumPy dtype used ('bool'). |
| 64 | + type : type |
| 65 | + The scalar type for elements of this dtype (np.bool_). |
| 66 | +
|
| 67 | +
|
| 68 | + See Also |
| 69 | + -------- |
| 70 | + BooleanArray : Extension array for boolean data with missing values. |
| 71 | + StringDtype : Extension dtype for string data. |
| 72 | + array : Create a pandas array with a specific dtype. |
| 73 | + Series : One-dimensional ndarray with axis labels. |
| 74 | + DataFrame : Two-dimensional, size-mutable, tabular data. |
45 | 75 |
|
46 | | - BooleanDtype is used to represent boolean data (True/False), with the ability to |
47 | | - handle missing (NA) values through pandas' extension dtype system. This allows |
48 | | - for efficient storage, computation, and interoperability with nullable boolean |
49 | | - arrays in pandas objects. |
50 | | -
|
51 | | - .. warning:: |
52 | | -
|
53 | | - BooleanDtype is considered experimental. The implementation and |
54 | | - parts of the API may change without warning. |
55 | | -
|
56 | | - Attributes |
57 | | - ---------- |
58 | | - name : str |
59 | | - String identifying the dtype ('boolean'). |
60 | | - kind : str |
61 | | - The kind of data ('b' for boolean). |
62 | | - numpy_dtype : numpy.dtype |
63 | | - The underlying NumPy dtype used ('bool'). |
64 | | - type : type |
65 | | - The scalar type for elements of this dtype (np.bool_). |
66 | | -
|
67 | | -
|
68 | | - See Also |
69 | | - -------- |
70 | | - BooleanArray : Extension array for boolean data with missing values. |
71 | | - StringDtype : Extension dtype for string data. |
72 | | - array : Create a pandas array with a specific dtype. |
73 | | - Series : One-dimensional ndarray with axis labels. |
74 | | - DataFrame : Two-dimensional, size-mutable, tabular data. |
75 | | -
|
76 | | - Examples |
77 | | - -------- |
78 | | - Create a Series with BooleanDtype: |
| 76 | + Examples |
| 77 | + -------- |
| 78 | + Create a Series with BooleanDtype: |
79 | 79 |
|
80 | | - >>> s = pd.Series([True, False, None], dtype='boolean') |
81 | | - >>> s |
82 | | - 0 True |
83 | | - 1 False |
84 | | - 2 <NA> |
85 | | - dtype: boolean |
| 80 | + >>> s = pd.Series([True, False, None], dtype="boolean") |
| 81 | + >>> s |
| 82 | + 0 True |
| 83 | + 1 False |
| 84 | + 2 <NA> |
| 85 | + dtype: boolean |
86 | 86 |
|
87 | | - You can construct BooleanDtype directly: |
| 87 | + You can construct BooleanDtype directly: |
88 | 88 |
|
89 | | - >>> pd.BooleanDtype() |
90 | | - BooleanDtype |
| 89 | + >>> pd.BooleanDtype() |
| 90 | + BooleanDtype |
91 | 91 |
|
92 | | - Check that a Series has BooleanDtype: |
| 92 | + Check that a Series has BooleanDtype: |
93 | 93 |
|
94 | | - >>> s.dtype |
95 | | - BooleanDtype |
96 | | -""" |
| 94 | + >>> s.dtype |
| 95 | + BooleanDtype |
| 96 | + """ |
97 | 97 |
|
98 | 98 | name: ClassVar[str] = "boolean" |
99 | 99 |
|
|
0 commit comments