Skip to content

Commit d0be37b

Browse files
committed
DOC: Fix various warnings
I'm trying to get our doc build cleaned up. Just fixing warnings in this one (mostly formatting, some references). Section name warnings Warning from computation.rst Remove references to invalid index / columns Various docstring fixups More warnings More warnings
1 parent c176a3c commit d0be37b

File tree

15 files changed

+58
-37
lines changed

15 files changed

+58
-37
lines changed

doc/source/api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ Interval
18221822
Properties
18231823
~~~~~~~~~~
18241824
.. autosummary::
1825-
:toctree generated/
1825+
:toctree: generated/
18261826

18271827
Interval.closed
18281828
Interval.closed_left
@@ -1843,7 +1843,7 @@ Timedelta
18431843
Properties
18441844
~~~~~~~~~~
18451845
.. autosummary::
1846-
:toctree generated/
1846+
:toctree: generated/
18471847

18481848
Timedelta.asm8
18491849
Timedelta.components
@@ -1860,7 +1860,7 @@ Properties
18601860
Methods
18611861
~~~~~~~
18621862
.. autosummary::
1863-
:toctree generated/
1863+
:toctree: generated/
18641864

18651865
Timedelta.ceil
18661866
Timedelta.floor

doc/source/computation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ columns of a ``DataFrame``:
670670

671671
.. ipython:: python
672672
:okexcept:
673+
:okwarning:
673674
674675
r.agg({'A' : np.sum,
675676
'B' : lambda x: np.std(x, ddof=1)})

doc/source/conf.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,12 @@
358358
# latex_use_modindex = True
359359

360360

361-
# Example configuration for intersphinx: refer to the Python standard library.
362361
intersphinx_mapping = {
363362
'statsmodels': ('http://www.statsmodels.org/devel/', None),
364363
'matplotlib': ('http://matplotlib.org/', None),
365-
'python': ('http://docs.python.org/3', None),
366-
'numpy': ('http://docs.scipy.org/doc/numpy', None),
367-
'scipy': ('http://docs.scipy.org/doc/scipy/reference', None),
364+
'python': ('https://docs.python.org/3/', None),
365+
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
366+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
368367
'py': ('https://pylib.readthedocs.io/en/latest/', None)
369368
}
370369
import glob
@@ -573,6 +572,15 @@ def remove_flags_docstring(app, what, name, obj, options, lines):
573572
if what == "attribute" and name.endswith(".flags"):
574573
del lines[:]
575574

575+
576+
suppress_warnings = [
577+
# We "overwrite" autosummary with our PandasAutosummary, but
578+
# still want the regular autosummary setup to run. So we just
579+
# suppress this warning.
580+
'app.add_directive'
581+
]
582+
583+
576584
def setup(app):
577585
app.connect("autodoc-process-docstring", remove_flags_docstring)
578586
app.add_autodocumenter(AccessorDocumenter)

doc/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Bug reports must:
6060

6161
The issue will then show up to the *pandas* community and be open to comments/ideas from others.
6262

63-
.. _contributing.github
63+
.. _contributing.github:
6464

6565
Working with the code
6666
=====================

doc/source/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ header : int or list of ints, default ``'infer'``
115115
names : array-like, default ``None``
116116
List of column names to use. If file contains no header row, then you should
117117
explicitly pass ``header=None``. Duplicates in this list will cause
118-
a ``UserWarning`` to be issued.
118+
a ``UserWarning`` to be issued.
119119
index_col : int or sequence or ``False``, default ``None``
120120
Column to use as the row labels of the DataFrame. If a sequence is given, a
121121
MultiIndex is used. If you have a malformed file with delimiters at the end of

pandas/_libs/period.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ cdef class _Period(object):
966966
def strftime(self, fmt):
967967
"""
968968
Returns the string representation of the :class:`Period`, depending
969-
on the selected :keyword:`format`. :keyword:`format` must be a string
969+
on the selected ``fmt``. ``fmt`` must be a string
970970
containing one or several directives. The method recognizes the same
971971
directives as the :func:`time.strftime` function of the standard Python
972972
distribution, as well as the specific additional directives ``%f``,

pandas/_libs/tslib.pyx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,16 @@ class Timestamp(_Timestamp):
263263
The other two forms mimic the parameters from ``datetime.datetime``. They
264264
can be passed by either position or keyword, but not both mixed together.
265265
266-
:func:`datetime.datetime` Parameters
267-
------------------------------------
266+
Parameters
267+
----------
268268
269269
.. versionadded:: 0.19.0
270270
271271
year : int
272272
month : int
273273
day : int
274-
hour : int, optional, default is 0
275-
minute : int, optional, default is 0
276-
second : int, optional, default is 0
277-
microsecond : int, optional, default is 0
278-
tzinfo : datetime.tzinfo, optional, default is None
274+
hour, minute, second, microsecond : int, optional, default 0
275+
tzinfo : datetime.tzinfo, optional, default None
279276
"""
280277

281278
@classmethod
@@ -593,11 +590,13 @@ class Timestamp(_Timestamp):
593590
tz : string, pytz.timezone, dateutil.tz.tzfile or None
594591
Time zone for time which Timestamp will be converted to.
595592
None will remove timezone holding local time.
593+
596594
ambiguous : bool, 'NaT', default 'raise'
597595
- bool contains flags to determine if time is dst or not (note
598-
that this flag is only applicable for ambiguous fall dst dates)
596+
that this flag is only applicable for ambiguous fall dst dates)
599597
- 'NaT' will return NaT for an ambiguous time
600598
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
599+
601600
errors : 'raise', 'coerce', default 'raise'
602601
- 'raise' will raise a NonExistentTimeError if a timestamp is not
603602
valid in the specified timezone (e.g. due to a transition from
@@ -1916,7 +1915,7 @@ class Timedelta(_Timedelta):
19161915
Parameters
19171916
----------
19181917
value : Timedelta, timedelta, np.timedelta64, string, or integer
1919-
unit : string, [D,h,m,s,ms,us,ns]
1918+
unit : string, ``[D,h,m,s,ms,us,ns]``
19201919
Denote the unit of the input, if input is an integer. Default 'ns'.
19211920
days, seconds, microseconds,
19221921
milliseconds, minutes, hours, weeks : numeric, optional

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ cdef class _Timedelta(timedelta):
575575
def isoformat(self):
576576
"""
577577
Format Timedelta as ISO 8601 Duration like
578-
`P[n]Y[n]M[n]DT[n]H[n]M[n]S`, where the `[n]`s are replaced by the
578+
``P[n]Y[n]M[n]DT[n]H[n]M[n]S``, where the ``[n]`` s are replaced by the
579579
values. See https://en.wikipedia.org/wiki/ISO_8601#Durations
580580
581581
.. versionadded:: 0.20.0

pandas/core/computation/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def eval(expr, parser='pandas', engine=None, truediv=True,
202202
you can use to inject an additional collection of namespaces to use for
203203
variable lookup. For example, this is used in the
204204
:meth:`~pandas.DataFrame.query` method to inject the
205-
:attr:`~pandas.DataFrame.index` and :attr:`~pandas.DataFrame.columns`
205+
``DataFrame.index`` and ``DataFrame.columns``
206206
variables that refer to their respective :class:`~pandas.DataFrame`
207207
instance attributes.
208208
level : int, optional

pandas/core/frame.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
16921692
classes : str or list or tuple, default None
16931693
CSS class(es) to apply to the resulting html table
16941694
escape : boolean, default True
1695-
Convert the characters <, >, and & to HTML-safe sequences.=
1695+
Convert the characters <, >, and & to HTML-safe sequences.
16961696
max_rows : int, optional
16971697
Maximum number of rows to show before truncating. If None, show
16981698
all.
@@ -1703,6 +1703,7 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
17031703
Character recognized as decimal separator, e.g. ',' in Europe
17041704
17051705
.. versionadded:: 0.18.0
1706+
17061707
border : int
17071708
A ``border=border`` attribute is included in the opening
17081709
`<table>` tag. Default ``pd.options.html.border``.

pandas/core/generic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6276,6 +6276,7 @@ def truncate(self, before=None, after=None, axis=None, copy=True):
62766276
62776277
* 0 or 'index': apply truncation to rows
62786278
* 1 or 'columns': apply truncation to columns
6279+
62796280
Default is stat axis for given data type (0 for Series and
62806281
DataFrames, 1 for Panels)
62816282
copy : boolean, default is True,

pandas/core/groupby.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,8 @@ def _cumcount_array(self, ascending=True):
742742
ascending : bool, default True
743743
If False, number in reverse, from length of group - 1 to 0.
744744
745-
Note
746-
----
745+
Notes
746+
-----
747747
this is currently implementing sort=False
748748
(though the default is sort=True) for groupby in general
749749
"""

pandas/core/indexes/period.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,9 @@ def to_timestamp(self, freq=None, how='start'):
623623
624624
Parameters
625625
----------
626-
freq : string or DateOffset, default 'D' for week or longer, 'S'
627-
otherwise
628-
Target frequency
626+
freq : string or DateOffset, optional
627+
Target frequency. The default is 'D' for week or longer,
628+
'S' otherwise
629629
how : {'s', 'e', 'start', 'end'}
630630
631631
Returns
@@ -1038,8 +1038,8 @@ def tz_convert(self, tz):
10381038
-------
10391039
normalized : DatetimeIndex
10401040
1041-
Note
1042-
----
1041+
Notes
1042+
-----
10431043
Not currently implemented for PeriodIndex
10441044
"""
10451045
raise NotImplementedError("Not yet implemented for PeriodIndex")
@@ -1062,8 +1062,8 @@ def tz_localize(self, tz, infer_dst=False):
10621062
-------
10631063
localized : DatetimeIndex
10641064
1065-
Note
1066-
----
1065+
Notes
1066+
-----
10671067
Not currently implemented for PeriodIndex
10681068
"""
10691069
raise NotImplementedError("Not yet implemented for PeriodIndex")

pandas/io/formats/format.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,23 @@
8484
"match-parent", "initial", "unset")
8585

8686
justify_docstring = """
87-
justify : {'left', 'right', 'center', 'justify',
88-
'justify-all', 'start', 'end', 'inherit',
89-
'match-parent', 'initial', 'unset'}, default None
87+
justify : str, default None
9088
How to justify the column labels. If None uses the option from
9189
the print configuration (controlled by set_option), 'right' out
92-
of the box."""
90+
of the box. Valid values are
91+
92+
* left
93+
* right
94+
* center
95+
* justify
96+
* justify-all
97+
* start
98+
* end
99+
* inherit
100+
* match-parent
101+
* initial
102+
* unset
103+
"""
93104

94105
return_docstring = """
95106

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ def build_extensions(self):
225225
of the analysis into a form suitable for plotting or tabular display. pandas is
226226
the ideal tool for all of these tasks.
227227
228-
Note
229-
----
228+
Notes
229+
-----
230230
Windows binaries built against NumPy 1.8.1
231231
"""
232232

0 commit comments

Comments
 (0)