Skip to content

Commit

Permalink
docs: Minor layout/terminology improvement for selector set ops (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie authored Jun 30, 2024
1 parent 24e5c2c commit b725b1d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions py-polars/docs/source/reference/selectors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,22 @@ Set operations

Selectors support the following ``set`` operations:

- UNION: ``A | B``
- INTERSECTION: ``A & B``
- DIFFERENCE: ``A - B``
- EXCLUSIVE OR: ``A ^ B``
- COMPLEMENT: ``~A``
.. table::
:widths: 20 60

+------------------------+------------+
| Operation | Expression |
+========================+============+
| `UNION` | ``A | B`` |
+------------------------+------------+
| `INTERSECTION` | ``A & B`` |
+------------------------+------------+
| `DIFFERENCE` | ``A - B`` |
+------------------------+------------+
| `SYMMETRIC DIFFERENCE` | ``A ^ B`` |
+------------------------+------------+
| `COMPLEMENT` | ``~A`` |
+------------------------+------------+

Note that both individual selector results and selector set operations will always return
matching columns in the same order as the underlying frame schema.
Expand Down Expand Up @@ -91,7 +102,7 @@ Examples
"Lmn": pl.Duration,
}
# Select the EXCLUSIVE OR of numeric columns and columns that contain an "e"
# Select the SYMMETRIC DIFFERENCE of numeric columns and columns that contain an "e"
assert df.select(cs.contains("e") ^ cs.numeric()).schema == {
"abc": UInt16,
"bbb": UInt32,
Expand Down

0 comments on commit b725b1d

Please sign in to comment.