Skip to content

DOC: fix docstring validation errors for pandas.Series #59621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.dt.tz_localize PR01,PR02" \
-i "pandas.Series.dt.unit GL08" \
-i "pandas.Series.pad PR01,SA01" \
-i "pandas.Series.sem PR01,RT03,SA01" \
-i "pandas.Series.sparse PR01,SA01" \
-i "pandas.Series.sparse.fill_value SA01" \
-i "pandas.Series.sparse.from_coo PR07,SA01" \
-i "pandas.Series.sparse.npoints SA01" \
-i "pandas.Series.sparse.sp_values SA01" \
-i "pandas.Series.sparse.to_coo PR07,RT03,SA01" \
-i "pandas.Series.std PR01,RT03,SA01" \
-i "pandas.Timedelta.asm8 SA01" \
-i "pandas.Timedelta.ceil SA01" \
-i "pandas.Timedelta.components SA01" \
Expand Down
40 changes: 35 additions & 5 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11847,14 +11847,44 @@ def last_valid_index(self) -> Hashable:
where N represents the number of elements.
numeric_only : bool, default False
Include only float, int, boolean columns. Not implemented for Series.
**kwargs :
Additional keywords have no effect but might be accepted
for compatibility with NumPy.

Returns
-------
{name1} or {name2} (if level specified) \
{name1} or {name2} (if level specified)
{return_desc}

See Also
--------
{see_also}\
{notes}\
{examples}
"""

_sem_see_also = """\
scipy.stats.sem : Compute standard error of the mean.
{name2}.std : Return sample standard deviation over requested axis.
{name2}.var : Return unbiased variance over requested axis.
{name2}.mean : Return the mean of the values over the requested axis.
{name2}.median : Return the median of the values over the requested axis.
{name2}.mode : Return the mode(s) of the Series."""

_sem_return_desc = """\
Unbiased standard error of the mean over requested axis."""

_std_see_also = """\
numpy.std : Compute the standard deviation along the specified axis.
{name2}.var : Return unbiased variance over requested axis.
{name2}.sem : Return unbiased standard error of the mean over requested axis.
{name2}.mean : Return the mean of the values over the requested axis.
{name2}.median : Return the median of the values over the requested axis.
{name2}.mode : Return the mode(s) of the Series."""

_std_return_desc = """\
Standard deviation over requested axis."""

_std_notes = """

Notes
Expand Down Expand Up @@ -12706,8 +12736,8 @@ def make_doc(name: str, ndim: int) -> str:
"ddof argument."
)
examples = _std_examples
see_also = ""
kwargs = {"notes": _std_notes}
see_also = _std_see_also.format(name2=name2)
kwargs = {"notes": "", "return_desc": _std_return_desc}

elif name == "sem":
base_doc = _num_ddof_doc
Expand Down Expand Up @@ -12751,8 +12781,8 @@ def make_doc(name: str, ndim: int) -> str:
>>> df.sem(numeric_only=True)
a 0.5
dtype: float64"""
see_also = ""
kwargs = {"notes": ""}
see_also = _sem_see_also.format(name2=name2)
kwargs = {"notes": "", "return_desc": _sem_return_desc}

elif name == "skew":
base_doc = _num_doc
Expand Down
Loading