-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DOC: ongoing fixing of doctests #22459
Comments
I was looking into improving the docstrings of Also should there be separate examples/docstrings for |
I think you need to have
No, we're ok with mixing those. |
Note that since f6da1f1, |
@Moisan Thanks for noticing, updated the text |
[europandas sprint 2019] I'm working on the doctests of |
i see a lot of merged PRs, is this done? |
Looks like there are still some docstrings with errors:
Not many, I'll see if I can create specific issues for some of them. |
Reopening, I think we still have more doctests that are failing. We should be able to close this when our call to the doctests can simply be |
Starting with #19952, we run (some) doctests on Travis to ensure the example are kept up to date.
Currently, we only test the docstrings for Series and DataFrame, and reshape-related top level functions, and we also skip a lot of the tests.
So PRs to incrementally test more of the docstrings are very welcome, and can be good bite-sized newbie issues.
The workflow would be like this:
Take a certain function or a certain module
Fix the examples in the docstring(s):
To run the doctest for a single method, you can either use the validation script, eg:
to run a full module or a subset of them, you can use something like:
It is certainly welcome to also fix other problems with the docstring (all other errors and warnings that the validation script gives), or to actually improve the example. But I think it is also fine to do PRs just fixing the doctests as they are, so we at least can test them (so if that then somebody else improves the examples, we are sure those new examples are actually tested).
Some more details can be found here: http://pandas-docs.github.io/pandas-docs-travis/contributing.html#updating-a-pandas-docstring. And specifically, some tips on getting doctests to pass: http://pandas-docs.github.io/pandas-docs-travis/contributing_docstring.html#tips-for-getting-your-examples-pass-the-doctests
When the doctests pass for a certain function or module, add those (or remove the skip) to the ones that are tested on Travis.
For that, you need to edit the
ci/code_checks.sh
file. For example, for the Series tests, it looks like:pandas/ci/code_checks.sh
Lines 125 to 126 in cf11f71
Here, you could remove one of the skipped ones (the
-k"-agg"
syntax is to skip the doctests for Series.agg and Series.aggregate). Or add such a new line for a new module.Good docstrings to start with are the ones for Series and DataFrame (the ones located in
pandas/core/series.py
,pandas/core/frame.py
andpandas/core/generic.py
).After that, adding new modules like the indexing ones would be a possibility.
The text was updated successfully, but these errors were encountered: