Skip to content

Commit 6f71319

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 26760-converter
2 parents c12dc7c + a00659a commit 6f71319

Some content is hidden

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

68 files changed

+844
-717
lines changed

azure-pipelines.yml

+62-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
# XXX next command should avoid redefining the path in every step, but
2525
# made the process crash as it couldn't find deactivate
2626
#echo '##vso[task.prependpath]$HOME/miniconda3/bin'
27-
echo '##vso[task.setvariable variable=CONDA_ENV]pandas-dev'
2827
echo '##vso[task.setvariable variable=ENV_FILE]environment.yml'
2928
echo '##vso[task.setvariable variable=AZURE]true'
3029
displayName: 'Setting environment variables'
@@ -116,3 +115,65 @@ jobs:
116115
fi
117116
displayName: 'Running benchmarks'
118117
condition: true
118+
119+
- job: 'Docs'
120+
pool:
121+
vmImage: ubuntu-16.04
122+
timeoutInMinutes: 90
123+
steps:
124+
- script: |
125+
echo '##vso[task.setvariable variable=ENV_FILE]ci/deps/travis-36-doc.yaml'
126+
displayName: 'Setting environment variables'
127+
128+
- script: |
129+
export PATH=$HOME/miniconda3/bin:$PATH
130+
sudo apt-get install -y libc6-dev-i386
131+
ci/setup_env.sh
132+
displayName: 'Setup environment and build pandas'
133+
134+
- script: |
135+
export PATH=$HOME/miniconda3/bin:$PATH
136+
source activate pandas-dev
137+
doc/make.py
138+
displayName: 'Build documentation'
139+
140+
- script: |
141+
cd doc/build/html
142+
git init
143+
touch .nojekyll
144+
echo "dev.pandas.io" > CNAME
145+
git add --all .
146+
git config user.email "[email protected]"
147+
git config user.name "pandas-docs-bot"
148+
git commit -m "pandas documentation in master"
149+
displayName: 'Create git repo for docs build'
150+
condition : |
151+
and(not(eq(variables['Build.Reason'], 'PullRequest')),
152+
eq(variables['Build.SourceBranch'], 'refs/heads/master'))
153+
154+
# For `InstallSSHKey@0` to work, next steps are required:
155+
# 1. Generate a pair of private/public keys (i.e. `ssh-keygen -t rsa -b 4096 -C "[email protected]"`)
156+
# 2. Go to "Library > Secure files" in the Azure Pipelines dashboard: https://dev.azure.com/pandas-dev/pandas/_library?itemType=SecureFiles
157+
# 3. Click on "+ Secure file"
158+
# 4. Upload the private key (the name of the file must match with the specified in "sshKeySecureFile" input below, "pandas_docs_key")
159+
# 5. Click on file name after it is created, tick the box "Authorize for use in all pipelines" and save
160+
# 6. The public key specified in "sshPublicKey" is the pair of the uploaded private key, and needs to be set as a deploy key of the repo where the docs will be pushed (with write access): https://github.com/pandas-dev/pandas-dev.github.io/settings/keys
161+
- task: InstallSSHKey@0
162+
inputs:
163+
hostName: 'github.com,192.30.252.128 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='
164+
sshPublicKey: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHmz3l/EdqrgNxEUKkwDUuUcLv91unig03pYFGO/DMIgCmPdMG96zAgfnESd837Rm0wSSqylwSzkRJt5MV/TpFlcVifDLDQmUhqCeO8Z6dLl/oe35UKmyYICVwcvQTAaHNnYRpKC5IUlTh0JEtw9fGlnp1Ta7U1ENBLbKdpywczElhZu+hOQ892zqOj3CwA+U2329/d6cd7YnqIKoFN9DWT3kS5K6JE4IoBfQEVekIOs23bKjNLvPoOmi6CroAhu/K8j+NCWQjge5eJf2x/yTnIIP1PlEcXoHIr8io517posIx3TBup+CN8bNS1PpDW3jyD3ttl1uoBudjOQrobNnJeR6Rn67DRkG6IhSwr3BWj8alwUG5mTdZzwV5Pa9KZFdIiqX7NoDGg+itsR39QCn0thK8lGRNSR8KrWC1PSjecwelKBO7uQ7rnk/rkrZdBWR4oEA8YgNH8tirUw5WfOr5a0AIaJicKxGKNdMxZt+zmC+bS7F4YCOGIm9KHa43RrKhoGRhRf9fHHHKUPwFGqtWG4ykcUgoamDOURJyepesBAO3FiRE9rLU6ILbB3yEqqoekborHmAJD5vf7PWItW3Q/YQKuk3kkqRcKnexPyzyyq5lUgTi8CxxZdaASIOu294wjBhhdyHlXEkVTNJ9JKkj/obF+XiIIp0cBDsOXY9hDQ== [email protected]'
165+
sshKeySecureFile: 'pandas_docs_key'
166+
displayName: 'Install GitHub ssh deployment key'
167+
condition : |
168+
and(not(eq(variables['Build.Reason'], 'PullRequest')),
169+
eq(variables['Build.SourceBranch'], 'refs/heads/master'))
170+
171+
- script: |
172+
cd doc/build/html
173+
git remote add origin [email protected]:pandas-dev/pandas-dev.github.io.git
174+
git push -f origin master
175+
exit 0 # FIXME this will leave the build green even if the step fails. To be removed when we are confident with this.
176+
displayName: 'Publish docs to GitHub pages'
177+
condition : |
178+
and(not(eq(variables['Build.Reason'], 'PullRequest')),
179+
eq(variables['Build.SourceBranch'], 'refs/heads/master'))

ci/deps/travis-36-doc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ dependencies:
3333
- pytz
3434
- scipy
3535
- seaborn
36-
# recursion error with sphinx 2.1.0. https://github.com/pandas-dev/pandas/issues/26723
37-
- sphinx==2.0.1
36+
# some styling is broken with sphinx >= 2 (https://github.com/pandas-dev/pandas/issues/26058)
37+
- sphinx=1.8.5
3838
- sqlalchemy
3939
- statsmodels
4040
- xarray

doc/source/conf.py

+4-57
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import jinja2
1919
from sphinx.ext.autosummary import _import_by_name
2020
from numpydoc.docscrape import NumpyDocString
21-
from numpydoc.docscrape_sphinx import SphinxDocString
21+
2222

2323
logger = logging.getLogger(__name__)
2424

@@ -110,6 +110,9 @@
110110
else None)))
111111
autosummary_generate = True if pattern is None else ['index']
112112

113+
# numpydoc
114+
numpydoc_attributes_as_param_list = False
115+
113116
# matplotlib plot directive
114117
plot_include_source = True
115118
plot_formats = [("png", 90)]
@@ -422,62 +425,6 @@
422425
]
423426

424427

425-
def sphinxdocstring_str(self, indent=0, func_role="obj"):
426-
# Pandas displays Attributes section in style like Methods section
427-
428-
# Function is copy of `SphinxDocString.__str__`
429-
ns = {
430-
'signature': self._str_signature(),
431-
'index': self._str_index(),
432-
'summary': self._str_summary(),
433-
'extended_summary': self._str_extended_summary(),
434-
'parameters': self._str_param_list('Parameters'),
435-
'returns': self._str_returns('Returns'),
436-
'yields': self._str_returns('Yields'),
437-
'other_parameters': self._str_param_list('Other Parameters'),
438-
'raises': self._str_param_list('Raises'),
439-
'warns': self._str_param_list('Warns'),
440-
'warnings': self._str_warnings(),
441-
'see_also': self._str_see_also(func_role),
442-
'notes': self._str_section('Notes'),
443-
'references': self._str_references(),
444-
'examples': self._str_examples(),
445-
# Replaced `self._str_param_list('Attributes', fake_autosummary=True)`
446-
# with `self._str_member_list('Attributes')`
447-
'attributes': self._str_member_list('Attributes'),
448-
'methods': self._str_member_list('Methods'),
449-
}
450-
ns = {k: '\n'.join(v) for k, v in ns.items()}
451-
452-
rendered = self.template.render(**ns)
453-
return '\n'.join(self._str_indent(rendered.split('\n'), indent))
454-
455-
456-
SphinxDocString.__str__ = sphinxdocstring_str
457-
458-
459-
# Fix "WARNING: Inline strong start-string without end-string."
460-
# PR #155 "Escape the * in *args and **kwargs" from numpydoc
461-
# Can be removed after PR merges in v0.9.0
462-
def decorate_process_param(func):
463-
def _escape_args_and_kwargs(name):
464-
if name[:2] == '**':
465-
return r'\*\*' + name[2:]
466-
elif name[:1] == '*':
467-
return r'\*' + name[1:]
468-
else:
469-
return name
470-
471-
def func_wrapper(self, param, desc, fake_autosummary):
472-
param = _escape_args_and_kwargs(param.strip())
473-
return func(self, param, desc, fake_autosummary)
474-
475-
return func_wrapper
476-
477-
478-
func = SphinxDocString._process_param
479-
SphinxDocString._process_param = decorate_process_param(func)
480-
481428
# Add custom Documenter to handle attributes/methods of an AccessorProperty
482429
# eg pandas.Series.str and pandas.Series.dt (see GH9322)
483430

doc/source/development/contributing.rst

+15
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,21 @@ as possible to avoid mass breakages.
499499
Additional standards are outlined on the `code style wiki
500500
page <https://github.com/pandas-dev/pandas/wiki/Code-Style-and-Conventions>`_.
501501

502+
Optional dependencies
503+
---------------------
504+
505+
Optional dependencies (e.g. matplotlib) should be imported with the private helper
506+
``pandas.compat._optional.import_optional_dependency``. This ensures a
507+
consistent error message when the dependency is not met.
508+
509+
All methods using an optional dependency should include a test asserting that an
510+
``ImportError`` is raised when the optional dependency is not found. This test
511+
should be skipped if the library is present.
512+
513+
All optional dependencies should be documented in
514+
:ref:`install.optional_dependencies` and the minimum required version should be
515+
set in the ``pandas.compat._optional.VERSIONS`` dict.
516+
502517
C (cpplint)
503518
~~~~~~~~~~~
504519

doc/source/install.rst

+62-80
Original file line numberDiff line numberDiff line change
@@ -252,87 +252,69 @@ Recommended Dependencies
252252
Optional Dependencies
253253
~~~~~~~~~~~~~~~~~~~~~
254254

255-
* `Cython <http://www.cython.org>`__: Only necessary to build development
256-
version. Version 0.28.2 or higher.
257-
* `SciPy <http://www.scipy.org>`__: miscellaneous statistical functions, Version 0.19.0 or higher
258-
* `xarray <http://xarray.pydata.org>`__: pandas like handling for > 2 dims. Version 0.8.2 or higher is recommended.
259-
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage, Version 3.4.2 or higher
260-
* `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.9.0): necessary for feather-based storage.
261-
* `Apache Parquet <https://parquet.apache.org/>`__, either `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.9.0) or `fastparquet <https://fastparquet.readthedocs.io/en/latest>`__ (>= 0.2.1) for parquet-based storage. The `snappy <https://pypi.org/project/python-snappy>`__ and `brotli <https://pypi.org/project/brotlipy>`__ are available for compression support.
262-
* `SQLAlchemy <http://www.sqlalchemy.org>`__: for SQL database support. Version 1.1.4 or higher recommended. Besides SQLAlchemy, you also need a database specific driver. You can find an overview of supported drivers for each SQL dialect in the `SQLAlchemy docs <http://docs.sqlalchemy.org/en/latest/dialects/index.html>`__. Some common drivers are:
263-
264-
* `psycopg2 <http://initd.org/psycopg/>`__: for PostgreSQL
265-
* `pymysql <https://github.com/PyMySQL/PyMySQL>`__: for MySQL.
266-
* `SQLite <https://docs.python.org/3/library/sqlite3.html>`__: for SQLite, this is included in Python's standard library by default.
267-
268-
* `matplotlib <http://matplotlib.org/>`__: for plotting, Version 2.2.2 or higher.
269-
* For Excel I/O:
270-
271-
* `xlrd/xlwt <http://www.python-excel.org/>`__: Excel reading (xlrd), version 1.0.0 or higher required, and writing (xlwt)
272-
* `openpyxl <https://openpyxl.readthedocs.io/en/stable/>`__: openpyxl version 2.4.0
273-
for writing .xlsx files (xlrd >= 1.0.0)
274-
* `XlsxWriter <https://pypi.org/project/XlsxWriter>`__: Alternative Excel writer
275-
276-
* `Jinja2 <http://jinja.pocoo.org/>`__: Template engine for conditional HTML formatting.
277-
* `s3fs <http://s3fs.readthedocs.io/>`__: necessary for Amazon S3 access (s3fs >= 0.0.8).
278-
* `blosc <https://pypi.org/project/blosc>`__: for msgpack compression using ``blosc``
279-
* `gcsfs <http://gcsfs.readthedocs.io/>`__: necessary for Google Cloud Storage access (gcsfs >= 0.1.0).
280-
* One of
281-
`qtpy <https://github.com/spyder-ide/qtpy>`__ (requires PyQt or PySide),
282-
`PyQt5 <https://www.riverbankcomputing.com/software/pyqt/download5>`__,
283-
`PyQt4 <http://www.riverbankcomputing.com/software/pyqt/download>`__,
284-
`xsel <http://www.vergenet.net/~conrad/software/xsel/>`__, or
285-
`xclip <https://github.com/astrand/xclip/>`__: necessary to use
286-
:func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation.
287-
* `pandas-gbq
288-
<https://pandas-gbq.readthedocs.io/en/latest/install.html#dependencies>`__:
289-
for Google BigQuery I/O. (pandas-gbq >= 0.8.0)
290-
291-
* One of the following combinations of libraries is needed to use the
292-
top-level :func:`~pandas.read_html` function:
293-
294-
.. versionchanged:: 0.23.0
295-
296-
.. note::
297-
298-
If using BeautifulSoup4 a minimum version of 4.4.1 is required
299-
300-
* `BeautifulSoup4`_ and `html5lib`_ (Any recent version of `html5lib`_ is
301-
okay.)
302-
* `BeautifulSoup4`_ and `lxml`_
303-
* `BeautifulSoup4`_ and `html5lib`_ and `lxml`_
304-
* Only `lxml`_, although see :ref:`HTML Table Parsing <io.html.gotchas>`
305-
for reasons as to why you should probably **not** take this approach.
306-
307-
.. warning::
308-
309-
* if you install `BeautifulSoup4`_ you must install either
310-
`lxml`_ or `html5lib`_ or both.
311-
:func:`~pandas.read_html` will **not** work with *only*
312-
`BeautifulSoup4`_ installed.
313-
* You are highly encouraged to read :ref:`HTML Table Parsing gotchas <io.html.gotchas>`.
314-
It explains issues surrounding the installation and
315-
usage of the above three libraries.
316-
317-
.. note::
318-
319-
* if you're on a system with ``apt-get`` you can do
320-
321-
.. code-block:: sh
322-
323-
sudo apt-get build-dep python-lxml
324-
325-
to get the necessary dependencies for installation of `lxml`_. This
326-
will prevent further headaches down the line.
327-
255+
Pandas has many optional dependencies that are only used for specific methods.
256+
For example, :func:`pandas.read_hdf` requires the ``pytables`` package. If the
257+
optional dependency is not installed, pandas will raise an ``ImportError`` when
258+
the method requiring that dependency is called.
259+
260+
========================= ================== =============================================================
261+
Dependency Minimum Version Notes
262+
========================= ================== =============================================================
263+
BeautifulSoup4 4.4.1 HTML parser for read_html (see :ref:`note <optional_html>`)
264+
Jinja2 Conditional formatting with DataFrame.style
265+
PyQt4 Clipboard I/O
266+
PyQt5 Clipboard I/O
267+
PyTables 3.4.2 HDF5-based reading / writing
268+
SQLAlchemy 1.1.4 SQL support for databases other than sqlite
269+
SciPy 0.19.0 Miscellaneous statistical functions
270+
XLsxWriter Excel writing
271+
blosc Compression for msgpack
272+
fastparquet 0.2.1 Parquet reading / writing
273+
gcsfs 0.1.0 Google Cloud Storage access
274+
html5lib HTML parser for read_html (see :ref:`note <optional_html>`)
275+
lxml HTML parser for read_html (see :ref:`note <optional_html>`)
276+
matplotlib 2.2.2 Visualization
277+
openpyxl 2.4.0 Reading / writing for xlsx files
278+
pandas-gbq 0.8.0 Google Big Query access
279+
psycopg2 PostgreSQL engine for sqlalchemy
280+
pyarrow 0.9.0 Parquet and feather reading / writing
281+
pymysql MySQL engine for sqlalchemy
282+
qtpy Clipboard I/O
283+
s3fs 0.0.8 Amazon S3 access
284+
xarray 0.8.2 pandas-like API for N-dimensional data
285+
xclip Clipboard I/O on linux
286+
xlrd 1.0.0 Excel reading
287+
xlwt 2.4.0 Excel writing
288+
xsel Clipboard I/O on linux
289+
zlib Compression for msgpack
290+
========================= ================== =============================================================
291+
292+
.. _optional_html:
293+
294+
Optional Dependencies for Parsing HTML
295+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296+
297+
One of the following combinations of libraries is needed to use the
298+
top-level :func:`~pandas.read_html` function:
299+
300+
.. versionchanged:: 0.23.0
301+
302+
* `BeautifulSoup4`_ and `html5lib`_
303+
* `BeautifulSoup4`_ and `lxml`_
304+
* `BeautifulSoup4`_ and `html5lib`_ and `lxml`_
305+
* Only `lxml`_, although see :ref:`HTML Table Parsing <io.html.gotchas>`
306+
for reasons as to why you should probably **not** take this approach.
307+
308+
.. warning::
309+
310+
* if you install `BeautifulSoup4`_ you must install either
311+
`lxml`_ or `html5lib`_ or both.
312+
:func:`~pandas.read_html` will **not** work with *only*
313+
`BeautifulSoup4`_ installed.
314+
* You are highly encouraged to read :ref:`HTML Table Parsing gotchas <io.html.gotchas>`.
315+
It explains issues surrounding the installation and
316+
usage of the above three libraries.
328317

329318
.. _html5lib: https://github.com/html5lib/html5lib-python
330319
.. _BeautifulSoup4: http://www.crummy.com/software/BeautifulSoup
331320
.. _lxml: http://lxml.de
332-
333-
.. note::
334-
335-
Without the optional dependencies, many useful features will not
336-
work. Hence, it is highly recommended that you install these. A packaged
337-
distribution like `Anaconda <http://docs.continuum.io/anaconda/>`__, `ActivePython <https://www.activestate.com/activepython/downloads>`__ (version 2.7 or 3.5), or `Enthought Canopy
338-
<http://enthought.com/products/canopy>`__ may be worth considering.

doc/source/reference/indexing.rst

+3
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ Numeric Index
190190
.. autosummary::
191191
:toctree: api/
192192

193+
RangeIndex.start
194+
RangeIndex.stop
195+
RangeIndex.step
193196
RangeIndex.from_range
194197

195198
.. _api.categoricalindex:

doc/source/reference/series.rst

+2
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ strings and apply several methods to it. These can be accessed like
472472
Series.str
473473
Series.cat
474474
Series.dt
475+
Series.sparse
476+
DataFrame.sparse
475477
Index.str
476478

477479
.. _api.series.cat:

doc/source/user_guide/missing_data.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ at the new values.
466466
.. _missing_data.interp_limits:
467467

468468
Interpolation Limits
469-
^^^^^^^^^^^^^^^^^^^^
469+
--------------------
470470

471471
Like other pandas fill methods, :meth:`~DataFrame.interpolate` accepts a ``limit`` keyword
472472
argument. Use this argument to limit the number of consecutive ``NaN`` values

doc/source/user_guide/reshaping.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ handling of NaN:
705705
you can use ``df["cat_col"] = pd.Categorical(df["col"])`` or
706706
``df["cat_col"] = df["col"].astype("category")``. For full docs on :class:`~pandas.Categorical`,
707707
see the :ref:`Categorical introduction <categorical>` and the
708-
:ref:`API documentation <api.categorical>`.
708+
:ref:`API documentation <api.arrays.categorical>`.
709709

710710
Examples
711711
--------

doc/source/user_guide/sparse.rst

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ A sparse array can be converted to a regular (dense) ndarray with :meth:`numpy.a
7777
np.asarray(sparr)
7878
7979
80+
.. _sparse.dtype:
81+
8082
SparseDtype
8183
-----------
8284

0 commit comments

Comments
 (0)