Since pandas has objects with the same API, e.g. DataFrame.fillna
Series.fillna
, some of these methods may leverage a shared docstring system using @Appender
, @Substitution
, @doc
and variables named like shared_docs
to dynamically generate docstring based on a template. While this helps reduce some duplication, the downsides are:
- The shared docstring system, at minimum, adds indirection and, at worse, is less clear than a hardcoded docstring for new contributions
- Since these docstrings are dynamic, they avoid docstring standardization and rules provide by Ruff. (These docstrings are validated by flake8 run in a subprocess, but it would be nice to remove this https://github.com/pandas-dev/pandas/blob/98c9c7f838d223e66f1459fab23ac178b29c2227/scripts/validate_docstrings.py#L203)
The task then is to replace methods that use @Appender
, @Substitution
or @doc
with a hardcoded docstring after the function signature. Since there are many methods that use these decorators, this issue should be completed in multiple PRs ,and therefore, this issue can be worked on by multiple contributors.
For those interested in working on this issue:
- Comment below on which directory you'll be working on, e.g.
fillna
- Submit a PR removing the above decorators from the method and inline and docstring substitutions made.
- If a shared docstring is defined on a class inherited by others, e.g.
NDFrame.fillna
has the docstring forSeries.fillna
andDataFrame.fillna
, you may need to add language that clarifies application to both e.g.Series
andDataFrame
- If a docstring is not inherited by another object, you can print the
__doc__
of a method in a Python terminal and copy-paste that as the new docstring.
- If a shared docstring is defined on a class inherited by others, e.g.
Once all uses of @Appender
, @Substitution
or @doc
are removed, a separate PR to remove these objects would be welcome.
Comment From: vivupadi
Hi.. I'd like to work on this issue. This will be my first contribution. I'm interested in working on 'dropna' method.