Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Minor layout/terminology improvement for selector set ops #17299

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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