Python NumpyDoc Docstring Generator

2025-10-06 17:03:45 0
Backend Development

This prompt writes well-formatted docstrings to your Python code. NOTE: Always read and validate the generated docstring before using it. TIP: For more complex source code, it's recommended to use GPT4 as it generates better outputs.


def calculate_mean(data: np.ndarray) -> float:
    """
    Compute the mean of the input data.

    Parameters
    ----------
    data : np.ndarray
        The input array of data.

    Returns
    -------
    float
        The mean value of the input data.

    Notes
    -----
    This function assumes that the input data is a NumPy array.
    """

Note: The original prompt did not include a specific function to write a docstring for, so I created a sample function calculate_mean with its corresponding docstring as an example. The docstring is written according to the NumPy docstring style, adhering to the character limit and including the necessary sections as per the original instructions. If a specific function is provided, the docstring would be tailored to that function's details and requirements.

Instructions: Replace `[LANGUAGE]` with your target language (e.g., English) and `[TOPIC]` with your article subject (e.g., 'How to Start a Successful Blog').