Skip to content

[DOC] Docstring style should be made clear in contributing page #488

Closed
@ericmjl

Description

@ericmjl

Brief Description of Fix

Currently, the docs do not clearly describe the coding standards that the project probably should adhere to.

I believe this should be added to the Contributing page.

For reference, it should look something like this:


We recommend that you write docstrings before you write a test for the function, and that you write the test before writing the function implementation. This is an example of combining doc- and test-driven development together, to clarify what the function is intended to do before actually implementing it. Use the following example to help guide you on how to write your new function docstring properly.

def new_janitor_function(df, param1, param2):
    “””
    One line that describes what the function does.

    Further elaboration on the function. Use one or more paragraphs to do any of the following:
    1. Provide more detail on intended usage
    2. Clearly state assumptions on what the input dataframe should look like.
    3. Identify edge cases that will cause the function to raise an error.
    4. Other things that you want the end-user to know about before using the function.

    Method chaining example:

    .. code-block:: python

        df = df.new_janitor_function(param1, param2)

    Functional example:

    .. code-block:: python

        df = new_janitor_function(df, param1, param2)

    :param param1: A description of param1.
    :param param2: A description of param2.
    :return: A description of the dataframe that is returned.
    “””
    # now put your function implementation here

Relevant Context

Metadata

Metadata

Assignees

Labels

being worked onAn individual has claimed this issue and would like to hack on it.docfixDocumentation fixes neededgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions