Skip to content

Commit 6079c26

Browse files
committed
Merge remote-tracking branch 'upstream/master' into unique_inverse_cython
2 parents 2423a05 + 1250500 commit 6079c26

File tree

223 files changed

+7476
-4786
lines changed

Some content is hidden

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

223 files changed

+7476
-4786
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,5 @@ doc/build/html/index.html
109109
# Windows specific leftover:
110110
doc/tmp.sv
111111
doc/source/styled.xlsx
112-
doc/source/templates/
113112
env/
114113
doc/source/savefig/

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323

2424
git:
2525
# for cloning
26-
depth: 1000
26+
depth: 1500
2727

2828
matrix:
2929
fast_finish: true

ci/build_docs.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "${TRAVIS_OS_NAME}" != "linux" ]; then
55
exit 0
66
fi
77

8-
cd "$TRAVIS_BUILD_DIR"
8+
cd "$TRAVIS_BUILD_DIR"/doc
99
echo "inside $0"
1010

1111
if [ "$DOC" ]; then
@@ -14,10 +14,6 @@ if [ "$DOC" ]; then
1414

1515
source activate pandas
1616

17-
mv "$TRAVIS_BUILD_DIR"/doc /tmp
18-
mv "$TRAVIS_BUILD_DIR/LICENSE" /tmp # included in the docs.
19-
cd /tmp/doc
20-
2117
echo ###############################
2218
echo # Log file for the doc build #
2319
echo ###############################
@@ -29,7 +25,7 @@ if [ "$DOC" ]; then
2925
echo # Create and send docs #
3026
echo ########################
3127

32-
cd /tmp/doc/build/html
28+
cd build/html
3329
git config --global user.email "[email protected]"
3430
git config --global user.name "pandas-docs-bot"
3531

ci/deps/travis-36-doc.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ dependencies:
88
- bottleneck
99
- cython>=0.28.2
1010
- fastparquet
11+
- gitpython
1112
- html5lib
1213
- hypothesis>=3.58.0
1314
- ipykernel
14-
- ipython==6.5.0
15+
- ipython
1516
- ipywidgets
1617
- lxml
1718
- matplotlib

ci/deps/travis-36.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99
- fastparquet
1010
- flake8>=3.5
1111
- flake8-comprehensions
12-
- flake8-rst
12+
- flake8-rst=0.4.2
1313
- gcsfs
1414
- geopandas
1515
- html5lib

doc/make.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ def _process_single_doc(self, single_doc):
126126
self.single_doc = 'api'
127127
elif os.path.exists(os.path.join(SOURCE_PATH, single_doc)):
128128
self.single_doc_type = 'rst'
129-
self.single_doc = os.path.splitext(os.path.basename(single_doc))[0]
129+
130+
if 'whatsnew' in single_doc:
131+
basename = single_doc
132+
else:
133+
basename = os.path.basename(single_doc)
134+
self.single_doc = os.path.splitext(basename)[0]
130135
elif os.path.exists(
131136
os.path.join(SOURCE_PATH, '{}.rst'.format(single_doc))):
132137
self.single_doc_type = 'rst'

doc/source/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ Index Types
702702

703703
We have discussed ``MultiIndex`` in the previous sections pretty extensively.
704704
Documentation about ``DatetimeIndex`` and ``PeriodIndex`` are shown :ref:`here <timeseries.overview>`,
705-
and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.timedeltaindex>`.
705+
and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.index>`.
706706

707707
In the following sub-sections we will highlight some other index types.
708708

doc/source/api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ MultiIndex Components
17241724
MultiIndex.set_levels
17251725
MultiIndex.set_labels
17261726
MultiIndex.to_hierarchical
1727+
MultiIndex.to_flat_index
17271728
MultiIndex.to_frame
17281729
MultiIndex.is_lexsorted
17291730
MultiIndex.sortlevel

doc/source/conf.py

+40-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
# documentation root, use os.path.abspath to make it absolute, like shown here.
4141
# sys.path.append(os.path.abspath('.'))
4242
sys.path.insert(0, os.path.abspath('../sphinxext'))
43-
4443
sys.path.extend([
4544

4645
# numpy standard doc extensions
@@ -75,6 +74,7 @@
7574
'sphinx.ext.ifconfig',
7675
'sphinx.ext.linkcode',
7776
'nbsphinx',
77+
'contributors', # custom pandas extension
7878
]
7979

8080
try:
@@ -120,7 +120,9 @@
120120
templates_path = ['../_templates']
121121

122122
# The suffix of source filenames.
123-
source_suffix = '.rst'
123+
source_suffix = [
124+
'.rst',
125+
]
124126

125127
# The encoding of source files.
126128
source_encoding = 'utf-8'
@@ -298,8 +300,26 @@
298300
for page in moved_api_pages
299301
}
300302

303+
304+
common_imports = """\
305+
.. currentmodule:: pandas
306+
307+
.. ipython:: python
308+
:suppress:
309+
310+
import numpy as np
311+
from pandas import *
312+
import pandas as pd
313+
randn = np.random.randn
314+
np.set_printoptions(precision=4, suppress=True)
315+
options.display.max_rows = 15
316+
from pandas.compat import StringIO
317+
"""
318+
319+
301320
html_context = {
302-
'redirects': {old: new for old, new in moved_api_pages}
321+
'redirects': {old: new for old, new in moved_api_pages},
322+
'common_imports': common_imports,
303323
}
304324

305325
# If false, no module index is generated.
@@ -388,6 +408,7 @@
388408
category=FutureWarning)
389409

390410

411+
ipython_warning_is_error = False
391412
ipython_exec_lines = [
392413
'import numpy as np',
393414
'import pandas as pd',
@@ -653,7 +674,23 @@ def process_class_docstrings(app, what, name, obj, options, lines):
653674
]
654675

655676

677+
def rstjinja(app, docname, source):
678+
"""
679+
Render our pages as a jinja template for fancy templating goodness.
680+
"""
681+
# http://ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/
682+
# Make sure we're outputting HTML
683+
if app.builder.format != 'html':
684+
return
685+
src = source[0]
686+
rendered = app.builder.templates.render_string(
687+
src, app.config.html_context
688+
)
689+
source[0] = rendered
690+
691+
656692
def setup(app):
693+
app.connect("source-read", rstjinja)
657694
app.connect("autodoc-process-docstring", remove_flags_docstring)
658695
app.connect("autodoc-process-docstring", process_class_docstrings)
659696
app.add_autodocumenter(AccessorDocumenter)

doc/source/contributing.rst

+7-14
Original file line numberDiff line numberDiff line change
@@ -591,21 +591,14 @@ run this slightly modified command::
591591

592592
git diff master --name-only -- "*.py" | grep "pandas/" | xargs flake8
593593

594-
Note that on Windows, these commands are unfortunately not possible because
595-
commands like ``grep`` and ``xargs`` are not available natively. To imitate the
596-
behavior with the commands above, you should run::
594+
Windows does not support the ``grep`` and ``xargs`` commands (unless installed
595+
for example via the `MinGW <http://www.mingw.org/>`__ toolchain), but one can
596+
imitate the behaviour as follows::
597597

598-
git diff master --name-only -- "*.py"
598+
for /f %i in ('git diff upstream/master --name-only ^| findstr pandas/') do flake8 %i
599599

600-
This will list all of the Python files that have been modified. The only ones
601-
that matter during linting are any whose directory filepath begins with "pandas."
602-
For each filepath, copy and paste it after the ``flake8`` command as shown below:
603-
604-
flake8 <python-filepath>
605-
606-
Alternatively, you can install the ``grep`` and ``xargs`` commands via the
607-
`MinGW <http://www.mingw.org/>`__ toolchain, and it will allow you to run the
608-
commands above.
600+
This will also get all the files being changed by the PR (and within the
601+
``pandas/`` folder), and run ``flake8`` on them one after the other.
609602

610603
.. _contributing.import-formatting:
611604

@@ -1103,7 +1096,7 @@ Information on how to write a benchmark and how to use asv can be found in the
11031096
Documenting your code
11041097
---------------------
11051098

1106-
Changes should be reflected in the release notes located in ``doc/source/whatsnew/vx.y.z.txt``.
1099+
Changes should be reflected in the release notes located in ``doc/source/whatsnew/vx.y.z.rst``.
11071100
This file contains an ongoing change log for each release. Add an entry to this file to
11081101
document your fix, enhancement or (unavoidable) breaking change. Make sure to include the
11091102
GitHub issue number when adding your entry (using ``:issue:`1234``` where ``1234`` is the

doc/source/ecosystem.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ which are utilized by Jupyter Notebook for displaying
140140
(Note: HTML tables may or may not be
141141
compatible with non-HTML Jupyter output formats.)
142142

143-
See :ref:`Options and Settings <options>` and :ref:`options.available <available>`
143+
See :ref:`Options and Settings <options>` and :ref:`options.available`
144144
for pandas ``display.`` settings.
145145

146146
`quantopian/qgrid <https://github.com/quantopian/qgrid>`__

doc/source/index.rst.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ See the package overview for more detail about what's in the library.
118118
{{ single_doc }}
119119
{% endif -%}
120120
{% if not single_doc -%}
121-
whatsnew
121+
What's New <whatsnew/v0.24.0>
122122
install
123123
contributing
124124
overview
@@ -159,5 +159,5 @@ See the package overview for more detail about what's in the library.
159159
developer
160160
internals
161161
extending
162-
release
162+
releases
163163
{% endif -%}

doc/source/install.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ Optional Dependencies
286286
`xsel <http://www.vergenet.net/~conrad/software/xsel/>`__, or
287287
`xclip <https://github.com/astrand/xclip/>`__: necessary to use
288288
:func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation.
289-
* `pandas-gbq <https://pandas-gbq.readthedocs.io/en/latest/install.html#dependencies>`__: for Google BigQuery I/O.
289+
* `pandas-gbq
290+
<https://pandas-gbq.readthedocs.io/en/latest/install.html#dependencies>`__:
291+
for Google BigQuery I/O. (pandas-gbq >= 0.8.0)
290292

291293

292294
* `Backports.lzma <https://pypi.org/project/backports.lzma/>`__: Only for Python 2, for writing to and/or reading from an xz compressed DataFrame in CSV; Python 3 support is built into the standard library.

doc/source/io.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -1580,12 +1580,19 @@ You can pass in a URL to a CSV file:
15801580
df = pd.read_csv('https://download.bls.gov/pub/time.series/cu/cu.item',
15811581
sep='\t')
15821582
1583-
S3 URLs are handled as well:
1583+
S3 URLs are handled as well but require installing the `S3Fs
1584+
<https://pypi.org/project/s3fs/>`_ library:
15841585

15851586
.. code-block:: python
15861587
15871588
df = pd.read_csv('s3://pandas-test/tips.csv')
15881589
1590+
If your S3 bucket requires cedentials you will need to set them as environment
1591+
variables or in the ``~/.aws/credentials`` config file, refer to the `S3Fs
1592+
documentation on credentials
1593+
<https://s3fs.readthedocs.io/en/latest/#credentials>`_.
1594+
1595+
15891596

15901597
Writing out Data
15911598
''''''''''''''''
@@ -2854,6 +2861,11 @@ It is often the case that users will insert columns to do temporary computations
28542861
in Excel and you may not want to read in those columns. ``read_excel`` takes
28552862
a ``usecols`` keyword to allow you to specify a subset of columns to parse.
28562863

2864+
.. deprecated:: 0.24.0
2865+
2866+
Passing in an integer for ``usecols`` has been deprecated. Please pass in a list
2867+
of ints from 0 to ``usecols`` inclusive instead.
2868+
28572869
If ``usecols`` is an integer, then it is assumed to indicate the last column
28582870
to be parsed.
28592871

0 commit comments

Comments
 (0)