Skip to content

DOC: Add dateutil to intersphinx #24437 #24443

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 18 commits into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4446942
DOC: Fix docstrings with the sections in the wrong order #24280
benjaminr Dec 14, 2018
baa2950
DOC: Fix docstrings with the sections in the wrong order #24280
benjaminr Dec 14, 2018
c73c5f0
Removal of whitespace to satisfy flak8 checks.
benjaminr Dec 14, 2018
c042341
Merge branch 'master' of https://github.com/pandas-dev/pandas
benjaminr Dec 16, 2018
14fe729
Refactored _doc_template to _common_see_also and used with the substi…
benjaminr Dec 16, 2018
23350de
Updated CI checks to include GL07 docstring validation.
benjaminr Dec 16, 2018
3d18f6b
Docstring appends were in the wrong order - this corrects that. Altho…
benjaminr Dec 16, 2018
a1db80b
Use of format on _shared_docs['aggregate'] docstring usage to get the…
benjaminr Dec 17, 2018
faac16d
Merge branch 'master' of https://github.com/pandas-dev/pandas
benjaminr Dec 17, 2018
0a7ed6d
Merge branch 'master' of https://github.com/pandas-dev/pandas
benjaminr Dec 18, 2018
64af1fc
Updated to code check order and included GL07 in messages.
benjaminr Dec 18, 2018
3e54918
Use of substitution to clean up docstring order fix.
benjaminr Dec 18, 2018
5f64fcf
Corrected order of see_also and examples string defitions to match do…
benjaminr Dec 18, 2018
bdeb8ae
Updated name of _agg_see_also_doc to reflect fact it also contains a …
benjaminr Dec 18, 2018
fc5fc69
Fix added import statement to be in the correct order.
benjaminr Dec 18, 2018
828c03b
Merge of upstream changes.
benjaminr Dec 26, 2018
91d13fe
Addition of dateutil docs to intersphinx mapping to pull in objects f…
benjaminr Dec 26, 2018
ae6aa27
Reordered listing of mapping to be alphabetical.
benjaminr Dec 26, 2018
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
Prev Previous commit
Next Next commit
Use of format on _shared_docs['aggregate'] docstring usage to get the…
… order right.
  • Loading branch information
benjaminr committed Dec 17, 2018
commit a1db80b105872441dfcd2da76a68a2423ab0596d
12 changes: 7 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6037,7 +6037,7 @@ def _gotitem(self,
# TODO: _shallow_copy(subset)?
return subset[key]

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
The aggregation operations are always performed over an axis, either the
index (default) or the column axis. This behavior is different from
`numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
Expand All @@ -6057,7 +6057,9 @@ def _gotitem(self,
pandas.core.window.Expanding : Perform operations over expanding window.
pandas.core.window.EWM : Perform operation over exponential weighted
window.
""")

_agg_examples_doc = dedent("""
Examples
--------
>>> df = pd.DataFrame([[1, 2, 3],
Expand Down Expand Up @@ -6091,10 +6093,10 @@ def _gotitem(self,
dtype: float64
""")

@Appender(_agg_doc)
@Appender(_shared_docs['aggregate'] % dict(
versionadded='.. versionadded:: 0.20.0',
**_shared_doc_kwargs))
@Appender(_shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(versionadded='.. versionadded:: 0.20.0', **_shared_doc_kwargs))
def aggregate(self, func, axis=0, *args, **kwargs):
axis = self._get_axis_number(axis)

Expand Down
7 changes: 6 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import operator
import warnings
import weakref
from textwrap import dedent

import numpy as np

Expand Down Expand Up @@ -4895,7 +4896,7 @@ def sample(self, n=None, frac=None, replace=False, weights=None,
def pipe(self, func, *args, **kwargs):
return com._pipe(self, func, *args, **kwargs)

_shared_docs['aggregate'] = ("""
_shared_docs['aggregate'] = dedent("""
Aggregate using one or more operations over the specified axis.

%(versionadded)s
Expand Down Expand Up @@ -4926,11 +4927,15 @@ def pipe(self, func, *args, **kwargs):
if Series.agg is called with single function, returns a scalar
if Series.agg is called with several functions, returns a Series

{see_also}

Notes
-----
`agg` is an alias for `aggregate`. Use the alias.

A passed user-defined-function will be passed a Series for evaluation.

{examples}
""")

_shared_docs['transform'] = ("""
Expand Down
10 changes: 7 additions & 3 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,13 +1246,15 @@ class DataFrameGroupBy(NDFrameGroupBy):

_block_agg_axis = 1

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
See Also
--------
pandas.DataFrame.groupby.apply
pandas.DataFrame.groupby.transform
pandas.DataFrame.aggregate
""")

_agg_examples_doc = dedent("""
Examples
--------

Expand Down Expand Up @@ -1302,8 +1304,10 @@ class DataFrameGroupBy(NDFrameGroupBy):
2 3 4 0.704907
""")

@Appender(_agg_doc)
@Appender(_shared_docs['aggregate'] % dict(
@Appender(_shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(
klass='DataFrame',
versionadded='',
axis=''))
Expand Down
10 changes: 7 additions & 3 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ def _assure_grouper(self):
def pipe(self, func, *args, **kwargs):
return super(Resampler, self).pipe(func, *args, **kwargs)

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
See Also
--------
pandas.DataFrame.groupby.aggregate
pandas.DataFrame.resample.transform
pandas.DataFrame.aggregate
""")

_agg_examples_doc = dedent("""
Examples
--------
>>> s = pd.Series([1,2,3,4,5],
Expand Down Expand Up @@ -253,8 +255,10 @@ def pipe(self, func, *args, **kwargs):
2013-01-01 00:00:04 5 NaN
""")

@Appender(_agg_doc)
@Appender(_shared_docs['aggregate'] % dict(
@Appender(_shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(
klass='DataFrame',
versionadded='',
axis=''))
Expand Down
16 changes: 8 additions & 8 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3275,16 +3275,16 @@ def _gotitem(self, key, ndim, subset=None):
"""
return self

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
See Also
--------
Series.apply : Invoke function on a Series.
Series.transform : Transform function producing
a Series with like indexes.
Series.transform : Transform function producing a Series with like indexes.
""")

_agg_examples_doc = dedent("""
Examples
--------

>>> s = pd.Series([1, 2, 3, 4])
>>> s
0 1
Expand All @@ -3302,10 +3302,10 @@ def _gotitem(self, key, ndim, subset=None):
dtype: int64
""")

@Appender(_agg_doc)
@Appender(generic._shared_docs['aggregate'] % dict(
versionadded='.. versionadded:: 0.20.0',
**_shared_doc_kwargs))
@Appender(generic._shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(versionadded='.. versionadded:: 0.20.0', **_shared_doc_kwargs))
def aggregate(self, func, axis=0, *args, **kwargs):
# Validate the axis parameter
self._get_axis_number(axis)
Expand Down
20 changes: 14 additions & 6 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1595,12 +1595,14 @@ def _validate_freq(self):
"compatible with a datetimelike "
"index".format(self.window))

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
See Also
--------
pandas.Series.rolling
pandas.DataFrame.rolling
""")

_agg_examples_doc = dedent("""
Examples
--------

Expand Down Expand Up @@ -1645,8 +1647,10 @@ def _validate_freq(self):
9 0.212668 -1.647453
""")

@Appender(_agg_doc)
@Appender(_shared_docs['aggregate'] % dict(
@Appender(_shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(
versionadded='',
klass='Series/DataFrame',
axis=''))
Expand Down Expand Up @@ -1883,13 +1887,15 @@ def _get_window(self, other=None):
other = self.min_periods or -1
return max(length, other)

_agg_doc = dedent("""
_agg_see_also_doc = dedent("""
See Also
--------
pandas.DataFrame.expanding.aggregate
pandas.DataFrame.rolling.aggregate
pandas.DataFrame.aggregate
""")

_agg_examples_doc = dedent("""
Examples
--------

Expand Down Expand Up @@ -1921,8 +1927,10 @@ def _get_window(self, other=None):
9 -0.286980 0.618493 -0.694496
""")

@Appender(_agg_doc)
@Appender(_shared_docs['aggregate'] % dict(
@Appender(_shared_docs['aggregate'].format(
see_also=_agg_see_also_doc,
examples=_agg_examples_doc
) % dict(
versionadded='',
klass='Series/DataFrame',
axis=''))
Expand Down