Skip to content

DOC: Updating Series.agg docstring #22474

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 2 commits into from
Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion ci/doctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ "$DOCTEST" ]; then
fi

pytest --doctest-modules -v pandas/core/series.py \
-k"-agg -map -nlargest -nonzero -nsmallest -reindex -searchsorted -to_dict"
-k"-nlargest -nonzero -nsmallest -reindex -searchsorted -to_dict"

if [ $? -ne "0" ]; then
RET=1
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4439,7 +4439,6 @@ def pipe(self, func, *args, **kwargs):
- function.
- list of functions.
- dict of column names -> functions (or list of functions).

%(axis)s
*args
Positional arguments to pass to `func`.
Expand Down Expand Up @@ -8146,7 +8145,7 @@ def mask(self, cond, other=np.nan, inplace=False, axis=None, level=None,
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
Number of periods to move, can be positive or negative.
freq : DateOffset, timedelta, or time rule string, optional
Increment to use from the tseries module or time rule (e.g. 'EOM').
See Notes.
Expand Down
17 changes: 8 additions & 9 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3046,21 +3046,21 @@ def _gotitem(self, key, ndim, subset=None):
Examples
--------

>>> s = pd.Series(np.random.randn(10))
>>> s = pd.Series(range(1,10,1))
Copy link
Member

Choose a reason for hiding this comment

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

As it doesn't make a difference for the example, I'd use [1, 2, 3, 4] instead of range (it makes the example easier to understand). In any case, please check pep8 in the examples, there are missing spaces after the commas.

Copy link
Member

Choose a reason for hiding this comment

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

Can you also show >>> s after creating it, and remove the blank line between the examples title and the code.


>>> s.agg('min')
-1.3018049988556679
1

>>> s.agg(['min', 'max'])
min -1.301805
max 1.127688
dtype: float64
min 1
max 9
dtype: int64

See also
--------
pandas.Series.apply
pandas.Series.transform

pandas.Series.apply : Invoke function on a Series.
pandas.Series.transform : Transform function producing
a Series with like indexes.
Copy link
Member

Choose a reason for hiding this comment

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

I think this should have the standard 4 spaces indentation.

""")

@Appender(_agg_doc)
Expand Down Expand Up @@ -3337,7 +3337,6 @@ def rename(self, index=None, **kwargs):
3 2
5 3
dtype: int64

"""
kwargs['inplace'] = validate_bool_kwarg(kwargs.get('inplace', False),
'inplace')
Expand Down