Skip to content

DOC: ongoing fixing of doctests #22459

@jorisvandenbossche

Description

@jorisvandenbossche

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):

  • 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

    pytest --doctest-modules -v pandas/core/series.py \
    -k"-nonzero -reindex -searchsorted -to_dict"

    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 and pandas/core/generic.py).
After that, adding new modules like the indexing ones would be a possibility.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions