Skip to content

DOC: bunch of docstring formatting fixes (sphinx warnings) #26117

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
Show file tree
Hide file tree
Changes from all 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: 8 additions & 8 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ class NaTType(_NaT):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -550,8 +550,8 @@ class NaTType(_NaT):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -584,8 +584,8 @@ class NaTType(_NaT):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -648,8 +648,8 @@ class NaTType(_NaT):
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down
16 changes: 8 additions & 8 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ class Timestamp(_Timestamp):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -497,8 +497,8 @@ class Timestamp(_Timestamp):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -533,8 +533,8 @@ class Timestamp(_Timestamp):
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

.. versionadded:: 0.24.0
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down Expand Up @@ -786,8 +786,8 @@ class Timestamp(_Timestamp):
- 'NaT' will return NaT for an ambiguous time
- 'raise' will raise an AmbiguousTimeError for an ambiguous time

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/tzconversion.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None,
- bool if True, treat all vals as DST. If False, treat them as non-DST
- 'NaT' will return NaT where there are ambiguous times

nonexistent : {None, "NaT", "shift_forward", "shift_backward", "raise",
timedelta-like}
nonexistent : {None, "NaT", "shift_forward", "shift_backward", "raise", \
timedelta-like}
How to handle non-existent times when converting wall times to UTC

.. versionadded:: 0.24.0
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ class TimelikeOps(object):

.. versionadded:: 0.24.0

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ def tz_localize(self, tz, ambiguous='raise', nonexistent='raise',
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
times

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta,
default 'raise'
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
A nonexistent time does not exist in a particular timezone
where clocks moved forward due to DST.

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6311,7 +6311,7 @@ def _gotitem(self,

@Substitution(see_also=_agg_summary_and_see_also_doc,
examples=_agg_examples_doc,
versionadded='.. versionadded:: 0.20.0',
versionadded='\n.. versionadded:: 0.20.0\n',
**_shared_doc_kwargs)
@Appender(_shared_docs['aggregate'])
def aggregate(self, func, axis=0, *args, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,8 @@ def nunique(self, dropna=True):
ham 1 1 2
spam 1 2 1

# check for rows with the same id but conflicting values
Check for rows with the same id but conflicting values:

>>> df.groupby('id').filter(lambda g: (g.nunique() > 1).any())
id value1 value2
0 spam 1 a
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3514,7 +3514,7 @@ def _gotitem(self, key, ndim, subset=None):

@Substitution(see_also=_agg_see_also_doc,
examples=_agg_examples_doc,
versionadded='.. versionadded:: 0.20.0',
versionadded='\n.. versionadded:: 0.20.0\n',
**_shared_doc_kwargs)
@Appender(generic._shared_docs['aggregate'])
def aggregate(self, func, axis=0, *args, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2127,8 +2127,7 @@ class EWM(_Rolling):
:math:`\alpha = 2 / (span + 1),\text{ for } span \geq 1`.
halflife : float, optional
Specify decay in terms of half-life,
:math:`\alpha = 1 - exp(log(0.5) / halflife),\text{ for }
halflife > 0`.
:math:`\alpha = 1 - exp(log(0.5) / halflife),\text{for} halflife > 0`.
alpha : float, optional
Specify smoothing factor :math:`\alpha` directly,
:math:`0 < \alpha \leq 1`.
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ def parser_f(filepath_or_buffer: FilePathOrBuffer,
summary="""Read general delimited file into DataFrame.

.. deprecated:: 0.24.0
Use :func:`pandas.read_csv` instead, passing ``sep='\\t'`` if necessary.""",
Use :func:`pandas.read_csv` instead, passing ``sep='\\t'`` if necessary.""",
_default_sep=r"'\\t' (tab-stop)")
)(read_table)

Expand Down
1 change: 0 additions & 1 deletion pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
Attempts to convert values of non-string, non-numeric objects (like
decimal.Decimal) to floating point. Can result in loss of Precision.
parse_dates : list or dict, default None
The behavior is as follows:
- List of column names to parse as dates.
- Dict of ``{column_name: format string}`` where format string is
strftime compatible in case of parsing string times or is one of
Expand Down
14 changes: 7 additions & 7 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2088,15 +2088,15 @@ def plot_series(data, kind='line', ax=None, # Series unique
-----
The return type depends on the `return_type` parameter:

* 'axes' : object of class matplotlib.axes.Axes
* 'dict' : dict of matplotlib.lines.Line2D objects
* 'both' : a namedtuple with structure (ax, lines)
* 'axes' : object of class matplotlib.axes.Axes
* 'dict' : dict of matplotlib.lines.Line2D objects
* 'both' : a namedtuple with structure (ax, lines)

For data grouped with ``by``:
For data grouped with ``by``, return a Series of the above or a numpy
array:

* :class:`~pandas.Series`
* :class:`~numpy.array` (for ``return_type = None``)
Return Series or numpy.array.
* :class:`~pandas.Series`
* :class:`~numpy.array` (for ``return_type = None``)

Use ``return_type='dict'`` when you want to tweak the appearance
of the lines after plotting. In this case a dict containing the Lines
Expand Down