Skip to content

Commit fbe270c

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

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
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

+28-14
Original file line numberDiff line numberDiff line change
@@ -4545,16 +4545,16 @@ def pipe(self, func, *args, **kwargs):
45454545
45464546
Parameters
45474547
----------
4548-
func : function, string, list of functions and/or strings or dict
4548+
func : function, str, list or dict
45494549
Function to use for aggregating the data. If a function, must either
45504550
work when passed a %(klass)s or when passed to %(klass)s.apply.
45514551
45524552
Accepted combinations are:
45534553
4554-
- string function name
45554554
- function
4556-
- list of functions and/or function names
4557-
- dict of axis labels -> functions, function names or list of such
4555+
- string function name
4556+
- list of functions and/or function names, e.g. ``[np.sum, 'mean']``
4557+
- dict of axis labels -> functions, function names or list of such.
45584558
%(axis)s
45594559
*args
45604560
Positional arguments to pass to `func`.
@@ -4563,7 +4563,11 @@ def pipe(self, func, *args, **kwargs):
45634563
45644564
Returns
45654565
-------
4566-
pandas.%(klass)s
4566+
DataFrame, Series or scalar
4567+
if DataFrame.agg is called with a single function, returns a Series
4568+
if DataFrame.agg is called with several functions, returns a DataFrame
4569+
if Series.agg is called with single function, returns a scalar
4570+
if Series.agg is called with several functions, returns a Series
45674571
45684572
Notes
45694573
-----
@@ -4580,15 +4584,15 @@ def pipe(self, func, *args, **kwargs):
45804584
45814585
Parameters
45824586
----------
4583-
func : function, string, list of functions and/or strings or dict
4587+
func : function, str, list or dict
45844588
Function to use for transforming the data. If a function, must either
45854589
work when passed a %(klass)s or when passed to %(klass)s.apply.
45864590
45874591
Accepted combinations are:
45884592
4589-
- string function name
45904593
- function
4591-
- list of functions and/or function names
4594+
- string function name
4595+
- list of functions and/or function names, e.g. ``[np.exp. 'sqrt']``
45924596
- dict of axis labels -> functions, function names or list of such.
45934597
%(axis)s
45944598
*args
@@ -4598,31 +4602,41 @@ def pipe(self, func, *args, **kwargs):
45984602
45994603
Returns
46004604
-------
4601-
pandas.%(klass)s
4605+
%(klass)s
46024606
A %(klass)s that must have the same length as self.
46034607
46044608
Raises
46054609
------
4606-
ValueError : if the returned %(klass)s has a different length than self.
4610+
ValueError : If the returned %(klass)s has a different length than self.
46074611
46084612
See Also
46094613
--------
4610-
pandas.%(klass)s.agg : only perform aggregating type operations
4611-
pandas.%(klass)s.apply : Invoke function on a Series
4614+
%(klass)s.agg : Only perform aggregating type operations.
4615+
%(klass)s.apply : Invoke function on a %(klass)s.
46124616
46134617
Examples
46144618
--------
46154619
>>> df = pd.DataFrame({'A': range(3), 'B': range(1, 4)})
4620+
>>> df
4621+
A B
4622+
0 0 1
4623+
1 1 2
4624+
2 2 3
46164625
>>> df.transform(lambda x: x + 1)
46174626
A B
46184627
0 1 2
46194628
1 2 3
46204629
2 3 4
46214630
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:
4631+
Even though the resulting %(klass)s must have the same length as the
4632+
input %(klass)s, it is possible to provide several input functions:
46244633
46254634
>>> s = pd.Series(range(3))
4635+
>>> s
4636+
0 0
4637+
1 1
4638+
2 2
4639+
dtype: int64
46264640
>>> s.transform([np.sqrt, np.exp])
46274641
sqrt exp
46284642
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)