Skip to content

Commit e474c20

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fu1+sort
2 parents 5be3917 + 0bfb61b commit e474c20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+908
-111
lines changed

doc/make.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ class DocBuilder:
7878
All public methods of this class can be called as parameters of the
7979
script.
8080
"""
81-
def __init__(self, num_jobs=1, include_api=True, single_doc=None):
81+
def __init__(self, num_jobs=1, include_api=True, single_doc=None,
82+
verbosity=0):
8283
self.num_jobs = num_jobs
8384
self.include_api = include_api
85+
self.verbosity = verbosity
8486
self.single_doc = None
8587
self.single_doc_type = None
8688
if single_doc is not None:
@@ -120,7 +122,7 @@ def _process_single_doc(self, single_doc):
120122
"""
121123
self.include_api = False
122124

123-
if single_doc == 'api.rst':
125+
if single_doc == 'api.rst' or single_doc == 'api':
124126
self.single_doc_type = 'api'
125127
self.single_doc = 'api'
126128
elif os.path.exists(os.path.join(SOURCE_PATH, single_doc)):
@@ -229,6 +231,8 @@ def _sphinx_build(self, kind):
229231
self._run_os('sphinx-build',
230232
'-j{}'.format(self.num_jobs),
231233
'-b{}'.format(kind),
234+
'-{}'.format(
235+
'v' * self.verbosity) if self.verbosity else '',
232236
'-d{}'.format(os.path.join(BUILD_PATH, 'doctrees')),
233237
'-Dexclude_patterns={}'.format(self.exclude_patterns),
234238
SOURCE_PATH,
@@ -330,6 +334,9 @@ def main():
330334
type=str,
331335
default=os.path.join(DOC_PATH, '..'),
332336
help='path')
337+
argparser.add_argument('-v', action='count', dest='verbosity', default=0,
338+
help=('increase verbosity (can be repeated), '
339+
'passed to the sphinx build command'))
333340
args = argparser.parse_args()
334341

335342
if args.command not in cmds:
@@ -338,9 +345,9 @@ def main():
338345

339346
os.environ['PYTHONPATH'] = args.python_path
340347

341-
getattr(DocBuilder(args.num_jobs,
342-
not args.no_api,
343-
args.single), args.command)()
348+
builder = DocBuilder(args.num_jobs, not args.no_api, args.single,
349+
args.verbosity)
350+
getattr(builder, args.command)()
344351

345352

346353
if __name__ == '__main__':

doc/source/conf.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,45 @@ def remove_flags_docstring(app, what, name, obj, options, lines):
552552
del lines[:]
553553

554554

555+
def process_class_docstrings(app, what, name, obj, options, lines):
556+
"""
557+
For those classes for which we use ::
558+
559+
:template: autosummary/class_without_autosummary.rst
560+
561+
the documented attributes/methods have to be listed in the class
562+
docstring. However, if one of those lists is empty, we use 'None',
563+
which then generates warnings in sphinx / ugly html output.
564+
This "autodoc-process-docstring" event connector removes that part
565+
from the processed docstring.
566+
567+
"""
568+
if what == "class":
569+
joined = '\n'.join(lines)
570+
571+
templates = [
572+
""".. rubric:: Attributes
573+
574+
.. autosummary::
575+
:toctree:
576+
577+
None
578+
""",
579+
""".. rubric:: Methods
580+
581+
.. autosummary::
582+
:toctree:
583+
584+
None
585+
"""
586+
]
587+
588+
for template in templates:
589+
if template in joined:
590+
joined = joined.replace(template, '')
591+
lines[:] = joined.split('\n')
592+
593+
555594
suppress_warnings = [
556595
# We "overwrite" autosummary with our PandasAutosummary, but
557596
# still want the regular autosummary setup to run. So we just
@@ -562,6 +601,7 @@ def remove_flags_docstring(app, what, name, obj, options, lines):
562601

563602
def setup(app):
564603
app.connect("autodoc-process-docstring", remove_flags_docstring)
604+
app.connect("autodoc-process-docstring", process_class_docstrings)
565605
app.add_autodocumenter(AccessorDocumenter)
566606
app.add_autodocumenter(AccessorAttributeDocumenter)
567607
app.add_autodocumenter(AccessorMethodDocumenter)

doc/source/dsintro.rst

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,28 @@ index is passed, one will be created having values ``[0, ..., len(data) - 1]``.
8181

8282
**From dict**
8383

84-
If ``data`` is a dict, if **index** is passed the values in data corresponding
85-
to the labels in the index will be pulled out. Otherwise, an index will be
86-
constructed from the sorted keys of the dict, if possible.
84+
Series can be instantiated from dicts:
85+
86+
.. ipython:: python
87+
88+
d = {'b' : 1, 'a' : 0, 'c' : 2}
89+
pd.Series(d)
90+
91+
.. note::
92+
93+
When the data is a dict, and an index is not passed, the ``Series`` index
94+
will be ordered by the dict's insertion order, if you're using Python
95+
version >= 3.6 and Pandas version >= 0.23.
96+
97+
If you're using Python < 3.6 or Pandas < 0.23, and an index is not passed,
98+
the ``Series`` index will be the lexically ordered list of dict keys.
99+
100+
In the example above, if you were on a Python version lower than 3.6 or a
101+
Pandas version lower than 0.23, the ``Series`` would be ordered by the lexical
102+
order of the dict keys (i.e. ``['a', 'b', 'c']`` rather than ``['b', 'a', 'c']``).
103+
104+
If an index is passed, the values in data corresponding to the labels in the
105+
index will be pulled out.
87106

88107
.. ipython:: python
89108
@@ -243,12 +262,22 @@ not matching up to the passed index.
243262
If axis labels are not passed, they will be constructed from the input data
244263
based on common sense rules.
245264

265+
.. note::
266+
267+
When the data is a dict, and ``columns`` is not specified, the ``DataFrame``
268+
columns will be ordered by the dict's insertion order, if you are using
269+
Python version >= 3.6 and Pandas >= 0.23.
270+
271+
If you are using Python < 3.6 or Pandas < 0.23, and ``columns`` is not
272+
specified, the ``DataFrame`` columns will be the lexically ordered list of dict
273+
keys.
274+
246275
From dict of Series or dicts
247276
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248277

249278
The resulting **index** will be the **union** of the indexes of the various
250279
Series. If there are any nested dicts, these will first be converted to
251-
Series. If no columns are passed, the columns will be the sorted list of dict
280+
Series. If no columns are passed, the columns will be the ordered list of dict
252281
keys.
253282

254283
.. ipython:: python

doc/source/install.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cross platform distribution for data analysis and scientific computing.
1212
This is the recommended installation method for most users.
1313

1414
Instructions for installing from source,
15-
`PyPI <http://pypi.python.org/pypi/pandas>`__, various Linux distributions, or a
15+
`PyPI <http://pypi.python.org/pypi/pandas>`__, `ActivePython <https://www.activestate.com/activepython/downloads>`__, various Linux distributions, or a
1616
`development version <http://github.com/pandas-dev/pandas>`__ are also provided.
1717

1818
Python version support
@@ -25,8 +25,8 @@ Installing pandas
2525

2626
.. _install.anaconda:
2727

28-
Installing pandas with Anaconda
29-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28+
Installing with Anaconda
29+
~~~~~~~~~~~~~~~~~~~~~~~~
3030

3131
Installing pandas and the rest of the `NumPy <http://www.numpy.org/>`__ and
3232
`SciPy <http://www.scipy.org/>`__ stack can be a little
@@ -58,8 +58,8 @@ that folder).
5858

5959
.. _install.miniconda:
6060

61-
Installing pandas with Miniconda
62-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
Installing with Miniconda
62+
~~~~~~~~~~~~~~~~~~~~~~~~~
6363

6464
The previous section outlined how to get pandas installed as part of the
6565
`Anaconda <http://docs.continuum.io/anaconda/>`__ distribution.
@@ -134,6 +134,13 @@ pandas can be installed via pip from
134134

135135
pip install pandas
136136

137+
Installing with ActivePython
138+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139+
140+
Installation instructions for
141+
`ActivePython <https://www.activestate.com/activepython>`__ can be found
142+
`here <https://www.activestate.com/activepython/downloads>`__. Versions
143+
2.7 and 3.5 include pandas.
137144

138145
Installing using your Linux distribution's package manager.
139146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -164,7 +171,7 @@ Installing from source
164171
See the :ref:`contributing documentation <contributing>` for complete instructions on building from the git source tree. Further, see :ref:`creating a development environment <contributing.dev_env>` if you wish to create a *pandas* development environment.
165172

166173
Running the test suite
167-
~~~~~~~~~~~~~~~~~~~~~~
174+
----------------------
168175

169176
pandas is equipped with an exhaustive set of unit tests, covering about 97% of
170177
the codebase as of this writing. To run it on your machine to verify that
@@ -299,5 +306,5 @@ Optional Dependencies
299306

300307
Without the optional dependencies, many useful features will not
301308
work. Hence, it is highly recommended that you install these. A packaged
302-
distribution like `Anaconda <http://docs.continuum.io/anaconda/>`__, or `Enthought Canopy
309+
distribution like `Anaconda <http://docs.continuum.io/anaconda/>`__, `ActivePython <https://www.activestate.com/activepython/downloads>`__ (version 2.7 or 3.5), or `Enthought Canopy
303310
<http://enthought.com/products/canopy>`__ may be worth considering.

doc/source/merging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ functionality below.
152152
Set logic on the other axes
153153
~~~~~~~~~~~~~~~~~~~~~~~~~~~
154154

155-
When gluing together multiple ``DataFrame``s, you have a choice of how to handle
155+
When gluing together multiple DataFrames, you have a choice of how to handle
156156
the other axes (other than the one being concatenated). This can be done in
157157
the following three ways:
158158

@@ -636,7 +636,7 @@ key combination:
636636
637637
Here is a more complicated example with multiple join keys. Only the keys
638638
appearing in ``left`` and ``right`` are present (the intersection), since
639-
``how='inner'```by default.
639+
``how='inner'`` by default.
640640

641641
.. ipython:: python
642642
@@ -721,7 +721,7 @@ either the left or right tables, the values in the joined table will be
721721
labels=['left', 'right'], vertical=False);
722722
plt.close('all');
723723
724-
Here is another example with duplicate join keys in ``DataFrame``s:
724+
Here is another example with duplicate join keys in DataFrames:
725725

726726
.. ipython:: python
727727

doc/source/options.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ display.html.table_schema False Whether to publish a Table
402402
display.html.border 1 A ``border=value`` attribute is
403403
inserted in the ``<table>`` tag
404404
for the DataFrame HTML repr.
405+
display.html.use_mathjax True When True, Jupyter notebook will process
406+
table contents using MathJax, rendering
407+
mathematical expressions enclosed by the
408+
dollar symbol.
405409
io.excel.xls.writer xlwt The default Excel writer engine for
406410
'xls' files.
407411
io.excel.xlsm.writer openpyxl The default Excel writer engine for

doc/source/tutorials.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ Video Tutorials
180180

181181
- `Pandas From The Ground Up <https://www.youtube.com/watch?v=5JnMutdy6Fw>`_
182182
(2015) (2:24)
183-
`GitHub repo <https://github.com/brandon-rhodes/pycon-pandas-tutorial>`_
183+
`GitHub repo <https://github.com/brandon-rhodes/pycon-pandas-tutorial>`__
184184
- `Introduction Into Pandas <https://www.youtube.com/watch?v=-NR-ynQg0YM>`_
185185
(2016) (1:28)
186-
`GitHub repo <https://github.com/chendaniely/2016-pydata-carolinas-pandas>`_
186+
`GitHub repo <https://github.com/chendaniely/2016-pydata-carolinas-pandas>`__
187187
- `Pandas: .head() to .tail() <https://www.youtube.com/watch?v=7vuO9QXDN50>`_
188188
(2016) (1:26)
189-
`GitHub repo <https://github.com/TomAugspurger/pydata-chi-h2t>`_
189+
`GitHub repo <https://github.com/TomAugspurger/pydata-chi-h2t>`__
190190

191191

192192
Various Tutorials

doc/source/visualization.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ Andrews Curves
870870

871871
Andrews curves allow one to plot multivariate data as a large number
872872
of curves that are created using the attributes of samples as coefficients
873-
for Fourier series, see the `Uncyclopedia entry<https://en.wikipedia.org/wiki/Andrews_plot>`_
873+
for Fourier series, see the `Uncyclopedia entry <https://en.wikipedia.org/wiki/Andrews_plot>`__
874874
for more information. By coloring these curves differently for each class
875875
it is possible to visualize data clustering. Curves belonging to samples
876876
of the same class will usually be closer together and form larger structures.
@@ -894,7 +894,7 @@ Parallel Coordinates
894894
~~~~~~~~~~~~~~~~~~~~
895895

896896
Parallel coordinates is a plotting technique for plotting multivariate data,
897-
see the `Uncyclopedia entry<https://en.wikipedia.org/wiki/Parallel_coordinates>`_
897+
see the `Uncyclopedia entry <https://en.wikipedia.org/wiki/Parallel_coordinates>`__
898898
for an introduction.
899899
Parallel coordinates allows one to see clusters in data and to estimate other statistics visually.
900900
Using parallel coordinates points are represented as connected line segments.
@@ -962,7 +962,7 @@ all time-lag separations. If time series is non-random then one or more of the
962962
autocorrelations will be significantly non-zero. The horizontal lines displayed
963963
in the plot correspond to 95% and 99% confidence bands. The dashed line is 99%
964964
confidence band. See the
965-
`Uncyclopedia entry<https://en.wikipedia.org/wiki/Correlogram>`_ for more about
965+
`Uncyclopedia entry <https://en.wikipedia.org/wiki/Correlogram>`__ for more about
966966
autocorrelation plots.
967967

968968
.. ipython:: python
@@ -1032,7 +1032,7 @@ unit interval). The point in the plane, where our sample settles to (where the
10321032
forces acting on our sample are at an equilibrium) is where a dot representing
10331033
our sample will be drawn. Depending on which class that sample belongs it will
10341034
be colored differently.
1035-
See the R package `Radviz<https://cran.r-project.org/web/packages/Radviz/>`_
1035+
See the R package `Radviz <https://cran.r-project.org/web/packages/Radviz/>`__
10361036
for more information.
10371037

10381038
**Note**: The "Iris" dataset is available `here <https://raw.github.com/pandas-dev/pandas/master/pandas/tests/data/iris.csv>`__.

0 commit comments

Comments
 (0)