Skip to content

Commit fff786f

Browse files
committed
doc fixup
1 parent 13c7ea3 commit fff786f

File tree

1 file changed

+31
-38
lines changed

1 file changed

+31
-38
lines changed

doc/source/user_guide/boolean.rst

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
.. currentmodule:: pandas
22

3+
.. ipython:: python
4+
:suppress:
5+
6+
import pandas as pd
7+
import numpy as np
8+
39
.. _boolean:
410

511
**************************
@@ -13,48 +19,33 @@ Nullable Boolean Data Type
1319
Kleene Logic
1420
------------
1521

16-
:class:`arrays.BooleanArray` implements Kleene logic (sometime called three-value logic) for
22+
:class:`arrays.BooleanArray` implements Kleene logic (sometimes called three-value logic) for
1723
logical operations like ``&`` (and), ``|`` (or) and ``^`` (exclusive-or).
1824

1925
Here's a table for ``and``.
2026

21-
========== =========== ============
22-
left value right value output value
23-
========== =========== ============
24-
True True True
25-
True False False
26-
True NA NA
27-
False False False
28-
False NA False
29-
NA NA NA
30-
========== =========== ============
31-
32-
33-
And for ``or``
34-
35-
========== =========== ============
36-
left value right value output value
37-
========== =========== ============
38-
True True True
39-
True False True
40-
True NA True
41-
False False False
42-
False NA NA
43-
NA NA NA
44-
========== =========== ============
45-
46-
And for ``xor``
47-
48-
========== =========== ============
49-
left value right value output value
50-
========== =========== ============
51-
True True False
52-
True False True
53-
True NA NA
54-
False False False
55-
False NA NA
56-
NA NA NA
57-
========== =========== ============
27+
================= =========
28+
Expression Result
29+
================= =========
30+
``True & True`` ``True``
31+
``True & False`` ``False``
32+
``True & NA`` ``NA``
33+
``False & False`` ``False``
34+
``False & NA`` ``False``
35+
``NA & NA`` ``NA``
36+
``True | True`` ``True``
37+
``True | False`` ``True``
38+
``True | NA`` ``True``
39+
``False | False`` ``False``
40+
``False | NA`` ``NA``
41+
``NA | NA`` ``NA``
42+
``True ^ True`` ``False``
43+
``True ^ False`` ``True``
44+
``True ^ NA`` ``NA``
45+
``False ^ False`` ``False``
46+
``False ^ NA`` ``NA``
47+
``NA ^ NA`` ``NA``
48+
================= =========
5849

5950
When an ``NA`` is present in an operation, the output value is ``NA`` only if
6051
the result cannot be determined soley based on the other input. For example,
@@ -79,5 +70,7 @@ In ``or``
7970
8071
In ``and``
8172

73+
.. ipython:: python
74+
8275
pd.Series([True, False, np.nan], dtype="object") & True
8376
pd.Series([True, False, np.nan], dtype="boolean") & True

0 commit comments

Comments
 (0)