Skip to content

DOC: Fix SA04 errors in docstrings #28792 #32182

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 3 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 10 additions & 6 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs):

See Also
--------
numpy.ndarray.argmax
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datapythonista is this a convention we're moving to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yea can be pretty repetitive /tedious but I don’t think there’s a way around it with the current docstring validation unless @datapythonista knows otherwise

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case my preference would be to leverage the context of the page we are in, and have as a description something like "Same function for numpy arrays.".

But I personally think that it adds value to have the elements in the see also, and a short comment on why they are related. I'm thinking on a new user visiting head, and how helpful it can be to know that a tail method exists, and that it "does the same as head but from the end of the dataframe".

Would you prefer to not have the descriptions?

numpy.ndarray.argmax : Return indices of the maximum values along
the given axis.
"""
nv.validate_minmax_axis(axis)
nv.validate_argmax_with_skipna(skipna, args, kwargs)
Expand Down Expand Up @@ -1005,7 +1006,8 @@ def argmin(self, axis=None, skipna=True, *args, **kwargs):

See Also
--------
numpy.ndarray.argmin
numpy.ndarray.argmin : Return indices of the minimum values along
the given axis.
"""
nv.validate_minmax_axis(axis)
nv.validate_argmax_with_skipna(skipna, args, kwargs)
Expand All @@ -1025,7 +1027,8 @@ def tolist(self):

See Also
--------
numpy.ndarray.tolist
numpy.ndarray.tolist : Return the array as an a.ndim-levels deep
nested list of Python scalars.
"""
if not isinstance(self._values, np.ndarray):
# check for ndarray instead of dtype to catch DTA/TDA
Expand Down Expand Up @@ -1371,7 +1374,8 @@ def memory_usage(self, deep=False):

See Also
--------
numpy.ndarray.nbytes
numpy.ndarray.nbytes : Total bytes consumed by the elements of the
array.

Notes
-----
Expand Down Expand Up @@ -1442,8 +1446,8 @@ def factorize(self, sort=False, na_sentinel=-1):

See Also
--------
sort_values
numpy.searchsorted
sort_values : Sort by the values along either axis.
numpy.searchsorted : Similar method from NumPy.

Notes
-----
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/computation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ def eval(

See Also
--------
DataFrame.query
DataFrame.eval
DataFrame.query : Evaluates a boolean expression to query the columns
of a frame.
DataFrame.eval : Evaluate a string describing operations on
DataFrame columns.

Notes
-----
Expand Down
17 changes: 10 additions & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,8 +1746,9 @@ def empty(self) -> bool_t:

See Also
--------
Series.dropna
DataFrame.dropna
Series.dropna : Return series without null values.
DataFrame.dropna : Return DataFrame with labels on given axis omitted
where (all or any) data are missing.

Notes
-----
Expand Down Expand Up @@ -2166,7 +2167,7 @@ def to_json(

See Also
--------
read_json
read_json : Convert a JSON string to pandas object.

Notes
-----
Expand Down Expand Up @@ -4447,7 +4448,8 @@ def filter(

See Also
--------
DataFrame.loc
DataFrame.loc : Access a group of rows and columns
by label(s) or a boolean array.

Notes
-----
Expand Down Expand Up @@ -4879,9 +4881,10 @@ def sample(

See Also
--------
DataFrame.apply
DataFrame.applymap
Series.map
DataFrame.apply : Apply a function along input axis of DataFrame.
DataFrame.applymap : Apply a function elementwise on a whole DataFrame.
Series.map : Apply a mapping correspondence on a
:class:`~pandas.Series`.

Notes
-----
Expand Down