Skip to content

Commit f33e2f9

Browse files
committed
adjust for more comments
1 parent 4bd8490 commit f33e2f9

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

ci/doctests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if [ "$DOCTEST" ]; then
2121

2222
# DataFrame / Series docstrings
2323
pytest --doctest-modules -v pandas/core/frame.py \
24-
-k"-assign -axes -combine -isin -itertuples -join -nlargest -nsmallest -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_dict -to_stata -transform"
24+
-k"-assign -axes -combine -isin -itertuples -join -nlargest -nsmallest -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_dict -to_stata"
2525

2626
if [ $? -ne "0" ]; then
2727
RET=1
@@ -35,7 +35,7 @@ if [ "$DOCTEST" ]; then
3535
fi
3636

3737
pytest --doctest-modules -v pandas/core/generic.py \
38-
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -resample -sample -to_json -to_xarray -transform -transpose -values -xs"
38+
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -resample -sample -to_json -to_xarray -transpose -values -xs"
3939

4040
if [ $? -ne "0" ]; then
4141
RET=1

pandas/core/frame.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,9 @@
109109
_shared_doc_kwargs = dict(
110110
axes='index, columns', klass='DataFrame',
111111
axes_single_arg="{0 or 'index', 1 or 'columns'}",
112-
axis="""
113-
axis : {0 or 'index', 1 or 'columns'}, default 0
114-
- 0 or 'index': apply function to each column.
115-
- 1 or 'columns': apply function to each row.""",
112+
axis="""axis : {0 or 'index', 1 or 'columns'}, default 0
113+
If 0 or 'index': apply function to each column.
114+
If 1 or 'columns': apply function to each row.""",
116115
optional_by="""
117116
by : str or list of str
118117
Name or list of names to sort by.

pandas/core/generic.py

+33-15
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@
6767
args_transpose='axes to permute (int or label for object)',
6868
optional_by="""
6969
by : str or list of str
70-
Name or list of names to sort by""")
70+
Name or list of names to sort by""",
71+
agg_return_type="""Scalar or Series
72+
Returns a scalar, if supplied a single argument and a Series
73+
if supplied multiple arguments.""",
74+
)
7175

7276

7377
def _single_replace(self, to_replace, method, inplace, limit):
@@ -4545,16 +4549,16 @@ def pipe(self, func, *args, **kwargs):
45454549
45464550
Parameters
45474551
----------
4548-
func : function, string, list of functions and/or strings or dict
4552+
func : function, str, list or dict
45494553
Function to use for aggregating the data. If a function, must either
45504554
work when passed a %(klass)s or when passed to %(klass)s.apply.
45514555
45524556
Accepted combinations are:
45534557
4554-
- string function name
45554558
- function
4556-
- list of functions and/or function names
4557-
- dict of axis labels -> functions, function names or list of such
4559+
- string function name
4560+
- list of functions and/or function names, e.g. ``[np.sum, 'mean']``
4561+
- dict of axis labels -> functions, function names or list of such.
45584562
%(axis)s
45594563
*args
45604564
Positional arguments to pass to `func`.
@@ -4563,7 +4567,11 @@ def pipe(self, func, *args, **kwargs):
45634567
45644568
Returns
45654569
-------
4566-
pandas.%(klass)s
4570+
DataFrame, Series or scalar
4571+
if DataFrame.agg is called with a single function, returns a Series
4572+
if DataFrame.agg is called with several functions, returns a DataFrame
4573+
if Series.agg is called with single function, returns a scalar
4574+
if Series.agg is called with several functions, returns a Series
45674575
45684576
Notes
45694577
-----
@@ -4580,15 +4588,15 @@ def pipe(self, func, *args, **kwargs):
45804588
45814589
Parameters
45824590
----------
4583-
func : function, string, list of functions and/or strings or dict
4591+
func : function, str, list or dict
45844592
Function to use for transforming the data. If a function, must either
45854593
work when passed a %(klass)s or when passed to %(klass)s.apply.
45864594
45874595
Accepted combinations are:
45884596
4589-
- string function name
45904597
- function
4591-
- list of functions and/or function names
4598+
- string function name
4599+
- list of functions and/or function names, e.g. ``[np.exp. 'sqrt']``
45924600
- dict of axis labels -> functions, function names or list of such.
45934601
%(axis)s
45944602
*args
@@ -4598,31 +4606,41 @@ def pipe(self, func, *args, **kwargs):
45984606
45994607
Returns
46004608
-------
4601-
pandas.%(klass)s
4609+
%(klass)s
46024610
A %(klass)s that must have the same length as self.
46034611
46044612
Raises
46054613
------
4606-
ValueError : if the returned %(klass)s has a different length than self.
4614+
ValueError : If the returned %(klass)s has a different length than self.
46074615
46084616
See Also
46094617
--------
4610-
pandas.%(klass)s.agg : only perform aggregating type operations
4611-
pandas.%(klass)s.apply : Invoke function on a Series
4618+
%(klass)s.agg : Only perform aggregating type operations.
4619+
%(klass)s.apply : Invoke function on a Series.
46124620
46134621
Examples
46144622
--------
46154623
>>> df = pd.DataFrame({'A': range(3), 'B': range(1, 4)})
4624+
>>> df
4625+
A B
4626+
0 0 1
4627+
1 1 2
4628+
2 2 3
46164629
>>> df.transform(lambda x: x + 1)
46174630
A B
46184631
0 1 2
46194632
1 2 3
46204633
2 3 4
46214634
4622-
Even though the resulting %(klass)s must have the length as the input
4623-
%(klass)s, it is possible to provide several input functions:
4635+
Even though the resulting %(klass)s must have the same length as the
4636+
input %(klass)s, it is possible to provide several input functions:
46244637
46254638
>>> s = pd.Series(range(3))
4639+
>>> s
4640+
0 0
4641+
1 1
4642+
2 2
4643+
dtype: int64
46264644
>>> s.transform([np.sqrt, np.exp])
46274645
sqrt exp
46284646
0 0.000000 1.000000

pandas/core/series.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@
8989

9090
_shared_doc_kwargs = dict(
9191
axes='index', klass='Series', axes_single_arg="{0 or 'index'}",
92-
axis="""
93-
axis : {0 or 'index'}
94-
Parameter needed for compatibility with DataFrame.
95-
""",
92+
axis="""axis : {0 or 'index'}
93+
Parameter needed for compatibility with DataFrame.""",
9694
inplace="""inplace : boolean, default False
9795
If True, performs operation inplace and returns None.""",
9896
unique='np.ndarray', duplicated='Series',

0 commit comments

Comments
 (0)