Skip to content

Commit 48e4667

Browse files
TomAugspurgerAndrew Bui
authored and
Andrew Bui
committed
DOC: Fix various warnings (#20509)
1 parent b1ffc5c commit 48e4667

14 files changed

+54
-39
lines changed

doc/source/comparison_with_r.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ In Python, this list would be a list of tuples, so
397397
pd.DataFrame(a)
398398
399399
For more details and examples see :ref:`the Into to Data Structures
400-
documentation <basics.dataframe.from_items>`.
400+
documentation <dsintro>`.
401401

402402
|meltdf|_
403403
~~~~~~~~~~~~~~~~

doc/source/contributing.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ Some other important things to know about the docs:
298298
Standard**. Follow the :ref:`pandas docstring guide <docstring>` for detailed
299299
instructions on how to write a correct docstring.
300300

301+
.. toctree::
302+
:maxdepth: 2
303+
304+
contributing_docstring.rst
305+
301306
- The tutorials make heavy use of the `ipython directive
302307
<http://matplotlib.org/sampledoc/ipython_directive.html>`_ sphinx extension.
303308
This directive lets you put code in the documentation which will be run
@@ -900,7 +905,7 @@ Documenting your code
900905
Changes should be reflected in the release notes located in ``doc/source/whatsnew/vx.y.z.txt``.
901906
This file contains an ongoing change log for each release. Add an entry to this file to
902907
document your fix, enhancement or (unavoidable) breaking change. Make sure to include the
903-
GitHub issue number when adding your entry (using `` :issue:`1234` `` where `1234` is the
908+
GitHub issue number when adding your entry (using ``:issue:`1234``` where ``1234`` is the
904909
issue/pull request number).
905910
906911
If your code is an enhancement, it is most likely necessary to add usage
@@ -1020,15 +1025,15 @@ release. To submit a pull request:
10201025
#. Click ``Send Pull Request``.
10211026
10221027
This request then goes to the repository maintainers, and they will review
1023-
the code.
1028+
the code.
10241029
10251030
.. _contributing.update-pr:
10261031
10271032
Updating your pull request
10281033
--------------------------
10291034
10301035
Based on the review you get on your pull request, you will probably need to make
1031-
some changes to the code. In that case, you can make them in your branch,
1036+
some changes to the code. In that case, you can make them in your branch,
10321037
add a new commit to that branch, push it to GitHub, and the pull request will be
10331038
automatically updated. Pushing them to GitHub again is done by::
10341039
@@ -1039,7 +1044,7 @@ This will automatically update your pull request with the latest code and restar
10391044
10401045
Another reason you might need to update your pull request is to solve conflicts
10411046
with changes that have been merged into the master branch since you opened your
1042-
pull request.
1047+
pull request.
10431048
10441049
To do this, you need to "merge upstream master" in your branch::
10451050

doc/source/cookbook.rst

+2
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ Levels
411411
`Flatten Hierarchical columns
412412
<http://stackoverflow.com/questions/14507794/python-pandas-how-to-flatten-a-hierarchical-index-in-columns>`__
413413

414+
.. _cookbook.missing_data:
415+
414416
Missing Data
415417
------------
416418

doc/source/io.rst

+2
Original file line numberDiff line numberDiff line change
@@ -3862,6 +3862,8 @@ Then create the index when finished appending.
38623862
38633863
See `here <http://stackoverflow.com/questions/17893370/ptrepack-sortby-needs-full-index>`__ for how to create a completely-sorted-index (CSI) on an existing store.
38643864

3865+
.. _io.hdf5-query-data-columns:
3866+
38653867
Query via Data Columns
38663868
++++++++++++++++++++++
38673869

doc/source/release.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Highlights include:
7171

7272
- Temporarily restore matplotlib datetime plotting functionality. This should
7373
resolve issues for users who relied implicitly on pandas to plot datetimes
74-
with matplotlib. See :ref:`here <whatsnew_0211.special>`.
74+
with matplotlib. See :ref:`here <whatsnew_0211.converters>`.
7575
- Improvements to the Parquet IO functions introduced in 0.21.0. See
7676
:ref:`here <whatsnew_0211.enhancements.parquet>`.
7777

doc/source/whatsnew/v0.10.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ N Dimensional Panels (Experimental)
409409
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410410

411411
Adding experimental support for Panel4D and factory functions to create n-dimensional named panels.
412-
:ref:`Docs <dsintro.panel4d>` for NDim. Here is a taste of what to expect.
412+
Here is a taste of what to expect.
413413

414414
.. code-block:: ipython
415415

doc/source/whatsnew/v0.16.1.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Highlights include:
2626

2727
.. warning::
2828

29-
In pandas 0.17.0, the sub-package ``pandas.io.data`` will be removed in favor of a separately installable package. See :ref:`here for details <remote_data.pandas_datareader>` (:issue:`8961`)
29+
In pandas 0.17.0, the sub-package ``pandas.io.data`` will be removed in favor of a separately installable package (:issue:`8961`).
3030

3131
Enhancements
3232
~~~~~~~~~~~~

doc/source/whatsnew/v0.23.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Other Enhancements
331331
:func:`pandas.api.extensions.register_series_accessor`, and
332332
:func:`pandas.api.extensions.register_index_accessor`, accessor for libraries downstream of pandas
333333
to register custom accessors like ``.cat`` on pandas objects. See
334-
:ref:`Registering Custom Accessors <developer.register-accessors>` for more (:issue:`14781`).
334+
:ref:`Registering Custom Accessors <extending.register-accessors>` for more (:issue:`14781`).
335335

336336
- ``IntervalIndex.astype`` now supports conversions between subtypes when passed an ``IntervalDtype`` (:issue:`19197`)
337337
- :class:`IntervalIndex` and its associated constructor methods (``from_arrays``, ``from_breaks``, ``from_tuples``) have gained a ``dtype`` parameter (:issue:`19262`)

doc/source/whatsnew/v0.6.1.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ New features
1616
- Add PyQt table widget to sandbox (:issue:`435`)
1717
- DataFrame.align can :ref:`accept Series arguments <basics.align.frame.series>`
1818
and an :ref:`axis option <basics.df_join>` (:issue:`461`)
19-
- Implement new :ref:`SparseArray <sparse.array>` and :ref:`SparseList <sparse.list>`
19+
- Implement new :ref:`SparseArray <sparse.array>` and `SparseList`
2020
data structures. SparseSeries now derives from SparseArray (:issue:`463`)
2121
- :ref:`Better console printing options <basics.console_output>` (:issue:`453`)
2222
- Implement fast :ref:`data ranking <computation.ranking>` for Series and
2323
DataFrame, fast versions of scipy.stats.rankdata (:issue:`428`)
24-
- Implement :ref:`DataFrame.from_items <basics.dataframe.from_items>` alternate
24+
- Implement `DataFrame.from_items` alternate
2525
constructor (:issue:`444`)
2626
- DataFrame.convert_objects method for :ref:`inferring better dtypes <basics.cast>`
2727
for object columns (:issue:`302`)

doc/source/whatsnew/v0.7.3.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ New features
2222
from pandas.tools.plotting import scatter_matrix
2323
scatter_matrix(df, alpha=0.2)
2424

25-
.. image:: _static/scatter_matrix_kde.png
25+
.. image:: savefig/scatter_matrix_kde.png
2626
:width: 5in
2727

2828
- Add ``stacked`` argument to Series and DataFrame's ``plot`` method for
@@ -32,14 +32,14 @@ New features
3232

3333
df.plot(kind='bar', stacked=True)
3434

35-
.. image:: _static/bar_plot_stacked_ex.png
35+
.. image:: savefig/bar_plot_stacked_ex.png
3636
:width: 4in
3737

3838
.. code-block:: python
3939

4040
df.plot(kind='barh', stacked=True)
4141

42-
.. image:: _static/barh_plot_stacked_ex.png
42+
.. image:: savefig/barh_plot_stacked_ex.png
4343
:width: 4in
4444

4545
- Add log x and y :ref:`scaling options <visualization.basic>` to

pandas/core/generic.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ def to_hdf(self, path_or_buf, key, **kwargs):
19001900
In order to add another DataFrame or Series to an existing HDF file
19011901
please use append mode and a different a key.
19021902
1903-
For more information see the :ref:`user guide <io.html#io-hdf5>`.
1903+
For more information see the :ref:`user guide <io.hdf5>`.
19041904
19051905
Parameters
19061906
----------
@@ -1929,8 +1929,7 @@ def to_hdf(self, path_or_buf, key, **kwargs):
19291929
data_columns : list of columns or True, optional
19301930
List of columns to create as indexed data columns for on-disk
19311931
queries, or True to use all columns. By default only the axes
1932-
of the object are indexed. See `here
1933-
<http://pandas.pydata.org/pandas-docs/stable/io.html#query-via-data-columns>`__.
1932+
of the object are indexed. See :ref:`io.hdf5-query-data-columns`.
19341933
Applicable only to format='table'.
19351934
complevel : {0-9}, optional
19361935
Specifies a compression level for data.
@@ -2141,7 +2140,7 @@ def to_pickle(self, path, compression='infer',
21412140
.. versionadded:: 0.20.0
21422141
protocol : int
21432142
Int which indicates which protocol should be used by the pickler,
2144-
default HIGHEST_PROTOCOL (see [1], paragraph 12.1.2). The possible
2143+
default HIGHEST_PROTOCOL (see [1]_ paragraph 12.1.2). The possible
21452144
values for this parameter depend on the version of Python. For
21462145
Python 2.x, possible values are 0, 1, 2. For Python>=3.0, 3 is a
21472146
valid value. For Python >= 3.4, 4 is a valid value. A negative

pandas/core/series.py

+15-13
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ def asobject(self):
467467
"""Return object Series which contains boxed values.
468468
469469
.. deprecated :: 0.23.0
470-
Use ``astype(object) instead.
471470
471+
Use ``astype(object) instead.
472472
473473
*this is an internal non-public method*
474474
"""
@@ -1772,18 +1772,20 @@ def idxmax(self, axis=0, skipna=True, *args, **kwargs):
17721772
return self.index[i]
17731773

17741774
# ndarray compat
1775-
argmin = deprecate('argmin', idxmin, '0.21.0',
1776-
msg="'argmin' is deprecated, use 'idxmin' instead. "
1777-
"The behavior of 'argmin' will be corrected to "
1778-
"return the positional minimum in the future. "
1779-
"Use 'series.values.argmin' to get the position of "
1780-
"the minimum now.")
1781-
argmax = deprecate('argmax', idxmax, '0.21.0',
1782-
msg="'argmax' is deprecated, use 'idxmax' instead. "
1783-
"The behavior of 'argmax' will be corrected to "
1784-
"return the positional maximum in the future. "
1785-
"Use 'series.values.argmax' to get the position of "
1786-
"the maximum now.")
1775+
argmin = deprecate(
1776+
'argmin', idxmin, '0.21.0',
1777+
msg=dedent("""\
1778+
'argmin' is deprecated, use 'idxmin' instead. The behavior of 'argmin'
1779+
will be corrected to return the positional minimum in the future.
1780+
Use 'series.values.argmin' to get the position of the minimum now.""")
1781+
)
1782+
argmax = deprecate(
1783+
'argmax', idxmax, '0.21.0',
1784+
msg=dedent("""\
1785+
'argmax' is deprecated, use 'idxmax' instead. The behavior of 'argmax'
1786+
will be corrected to return the positional maximum in the future.
1787+
Use 'series.values.argmax' to get the position of the maximum now.""")
1788+
)
17871789

17881790
def round(self, decimals=0, *args, **kwargs):
17891791
"""

pandas/plotting/_core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,7 @@ def hist(self, by=None, bins=10, **kwds):
31003100
31013101
A histogram is a representation of the distribution of data.
31023102
This function groups the values of all given Series in the DataFrame
3103-
into bins, and draws all bins in only one :ref:`matplotlib.axes.Axes`.
3103+
into bins and draws all bins in one :class:`matplotlib.axes.Axes`.
31043104
This is useful when the DataFrame's Series are in a similar scale.
31053105
31063106
Parameters

pandas/util/_decorators.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ def wrapper(*args, **kwargs):
4545
return alternative(*args, **kwargs)
4646

4747
# adding deprecated directive to the docstring
48-
msg = msg or 'Use `{alt_name}` instead.'
49-
docstring = '.. deprecated:: {}\n'.format(version)
50-
docstring += dedent(' ' + ('\n'.join(wrap(msg, 70))))
51-
52-
if getattr(wrapper, '__doc__') is not None:
53-
docstring += dedent(wrapper.__doc__)
54-
48+
msg = msg or 'Use `{alt_name}` instead.'.format(alt_name=alt_name)
49+
tpl = dedent("""
50+
.. deprecated:: {version}
51+
52+
{msg}
53+
54+
{rest}
55+
""")
56+
rest = getattr(wrapper, '__doc__', '')
57+
docstring = tpl.format(version=version,
58+
msg='\n '.join(wrap(msg, 70)),
59+
rest=dedent(rest))
5560
wrapper.__doc__ = docstring
5661

5762
return wrapper

0 commit comments

Comments
 (0)