@@ -365,6 +365,31 @@ This will identify methods documented in ``doc/source/api.rst`` that are not act
365
365
class methods, and existing methods that are not documented in ``doc/source/api.rst ``.
366
366
367
367
368
+ Updating a *pandas * docstring
369
+ -----------------------------
370
+
371
+ When improving a single function or method's docstring, it is not necessarily
372
+ needed to build to full documentation (see next section).
373
+ However, there is a script that checks a docstring (for example for the ``DataFrame.mean `` method)::
374
+
375
+ python scripts/validate_docstrings.py pandas.DataFrame.mean
376
+
377
+ This script will indicate some formatting errors if present, and will also
378
+ run and test the examples included in the docstring.
379
+ Check the :ref: `pandas docstring guide <docstring >` for a detailed guide
380
+ on how to format the docstring.
381
+
382
+ The examples in the docstring ('doctests') must be valid Python code,
383
+ that in a deterministic way returns the presented output, and that can be
384
+ copied and run by users. This can be checked with the script above, and is
385
+ also tested on Travis. A failing doctest will be a blocker for merging a PR.
386
+ Check the :ref: `examples <docstring.examples >` section in the docstring guide
387
+ for some tips and tricks to get the doctests passing.
388
+
389
+ When doing a PR with a docstring update, it is good to post the
390
+ output of the validation script in a comment on github.
391
+
392
+
368
393
How to build the *pandas * documentation
369
394
---------------------------------------
370
395
0 commit comments