-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
DOC: Add documentation for pandas.api.typing.Expression (#63084) #63090
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| pandas.API.typing.expression | ||
| ============================ | ||
|
|
||
| .. currentmodule:: pandas.api.typing | ||
|
|
||
| .. autoclass:: Expression | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
| **Description** | ||
|
|
||
| An ``Expression`` represents a symbolic reference to a DataFrame column. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is false, |
||
| It can be used inside functions like ``DataFrame.assign`` or ``DataFrame.loc`` to | ||
| refer to columns in a declarative way. | ||
|
|
||
| Example | ||
| ------- | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import pandas as pd | ||
|
|
||
| df = pd.DataFrame({"a": [1, 2, 3]}) | ||
| df.assign(b=pd.col("a") + 5) | ||
|
|
||
| **Supported Operations** | ||
|
|
||
| - Arithmetic: ``+``, ``-``, ``*``, ``/`` | ||
| - Comparison: ``<``, ``>``, ``==``, ``!=`` | ||
| - Universal functions (ufuncs): can be applied directly | ||
| - Series accessors: ``.dt``, ``.str``, ``.cat`` | ||
| - Series methods: ``.sum()``, ``.mean()``, ``.astype()``, etc. | ||
|
Comment on lines
+29
to
+33
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should generate the methods that an expression supports when building the API docs, not hardcode them. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API documentation is generated from docstrings, not added as files here directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean I should move this documentation into the Expression class docstring and remove the separate .rst page, index entry, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd also need to add the
Expressionclass to one of the API doc pages, yes. But as indicated in #63084 (comment), this might be opposed by others on the core team. I think we should ensure the core team is aligned here before moving forward.