pandas: DOC: fix SA05 errors in docstrings
Pandas has a script for validating docstrings:
Currently, some methods fail the SA05 check.
The task here is:
- take 2-4 methods
- run: scripts/validate_docstrings.py --format=actions --errors=SA05
method-name
- check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported
- remove those methods from code_checks.sh
- commit, push, open pull request
- Please don’t comment
take
as multiple people can work on this issue. You also don’t need to ask for permission to work on this, just comment on which methods are you going to work.
If you’re new contributor, please check the contributing guide
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 31 (31 by maintainers)
Ah gotcha! Thanks! Fixed it in recent commit.
I believe if this PR goes through, this issue can be closed.
I don’t see it, could you please double check if it went through?
Thanks!
Hi @jordan-d-murphy
Thanks for this! Btw, is your comment on the PR I raised?
@williamking1221 Yeah here’s some info on the ES01s from what I understand.
I’ll show two examples to illustrate: Running the following
scripts/validate_docstrings.py --format=actions --errors=ES01 pandas.Categorical.map
outputs:and running
scripts/validate_docstrings.py --format=actions --errors=ES01 pandas.Categorical.__array__
outputsIf we look at the docstrings, we can see a difference:
pandas.Categorical.array (fails with one ES01 - see the higlighted single line summary)
pandas.Categorical.map (passes with no ES01 - See highlighted Extended Summary)
Adding an extended summary fixes this:
updated output:
I dont’ know if that answers the question, but hopefully that’s a start.
EDIT: I just want to be clear this is an example of HOW to resolve the issue, but call out that we shouldn’t just start adding meaningless extended summaries in order to pass the checks.
@williamking1221 https://github.com/pandas-dev/pandas/issues/57440 for ESO1s
I’ll take
For the ES01 I have opened a PR to get these addressed. See https://github.com/pandas-dev/pandas/pull/57359
I have a merge conflict to resolve in order to get that merged, and then I’ll open an Issue to fix all ES01 errors. (Similar to this issue)
Hopefully that will happen later today when I get home from work. I need to do that from my personal laptop.
But feel free to fix it if you want to! The ultimate goal of All these issues I’m opening is to have correct docstrings for all the functions. I’m segmenting them out to give some structure to the process, but a fully correct docstring for each function is the end goal!
(Typing this from my phone is it’s hard to explain the fix for ES01, but when I get back to my personal laptop I’ll share more info on those fixes. For PRs opened under this issue it’s okay if other errors show up, as long as the SA05 errors are resolved.)
Seems like both are ok, even without changes. I’ll just remove these two then.
@jordan-d-murphy
Got it, Thanks.
Hey @jordan-d-murphy
I can take SeriesGroupBy : first and last once my previous PR gets merged.
I’ll take
pandas.core.groupby.DataFrameGroupBy.first pandas.core.groupby.DataFrameGroupBy.last
I’ll take
I don’t have permission to add them, but this could probably use some labels: