Skip to content

Commit f04196f

Browse files
author
saloni30agr
committed
DOC: pandas-dev#30694 - Restructure comment lines
2 parents 8ccd25f + a72eef5 commit f04196f

File tree

92 files changed

+1548
-2689
lines changed

Some content is hidden

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

92 files changed

+1548
-2689
lines changed

.pre-commit-config.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ repos:
2020
rev: v0.730
2121
hooks:
2222
- id: mypy
23-
# We run mypy over all files because of:
24-
# * changes in type definitions may affect non-touched files.
25-
# * Running it with `mypy pandas` and the filenames will lead to
26-
# spurious duplicate module errors,
27-
# see also https://github.com/pre-commit/mirrors-mypy/issues/5
28-
pass_filenames: false
2923
args:
30-
- pandas
24+
# As long as a some files are excluded from check-untyped-defs
25+
# we have to exclude it from the pre-commit hook as the configuration
26+
# is based on modules but the hook runs on files.
27+
- --no-check-untyped-defs
28+
- --follow-imports
29+
- skip
30+
files: pandas/

.travis.yml

+15-19
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ python: 3.7
77
# travis cache --delete inside the project directory from the travis command line client
88
# The cache directories will be deleted if anything in ci/ changes in a commit
99
cache:
10-
ccache: true
11-
directories:
12-
- $HOME/.cache # cython cache
13-
- $HOME/.ccache # compiler cache
10+
ccache: true
11+
directories:
12+
- $HOME/.cache # cython cache
13+
- $HOME/.ccache # compiler cache
1414

1515
env:
1616
global:
@@ -20,33 +20,30 @@ env:
2020
- secure: "EkWLZhbrp/mXJOx38CHjs7BnjXafsqHtwxPQrqWy457VDFWhIY1DMnIR/lOWG+a20Qv52sCsFtiZEmMfUjf0pLGXOqurdxbYBGJ7/ikFLk9yV2rDwiArUlVM9bWFnFxHvdz9zewBH55WurrY4ShZWyV+x2dWjjceWG5VpWeI6sA="
2121

2222
git:
23-
# for cloning
24-
depth: false
23+
# for cloning
24+
depth: false
2525

2626
matrix:
27-
fast_finish: true
28-
exclude:
29-
# Exclude the default Python 3.5 build
30-
- python: 3.5
27+
fast_finish: true
3128

32-
include:
29+
include:
3330
- env:
34-
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network)"
31+
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"
3532

3633
- env:
37-
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network)"
34+
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network and not clipboard)"
3835

3936
- env:
40-
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
37+
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
4138
services:
4239
- mysql
4340
- postgresql
4441

4542
- env:
4643
# Enabling Deprecations when running tests
47-
# You can set the environment variable PANDAS_TESTING_MODE to deprecate to show any DeprecationWarning message.
48-
# This is enabled in the travis builds for numpy 1.9 (and evenutally for the python 3.4 build).
49-
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36-cov.yaml" PATTERN="((not slow and not network) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
44+
# PANDAS_TESTING_MODE="deprecate" causes DeprecationWarning messages to be displayed in the logs
45+
# See pandas/_testing.py for more details.
46+
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36-cov.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
5047
services:
5148
- mysql
5249
- postgresql
@@ -76,7 +73,6 @@ before_install:
7673
# This overrides travis and tells it to look nowhere.
7774
- export BOTO_CONFIG=/dev/null
7875

79-
8076
install:
8177
- echo "install start"
8278
- ci/prep_cython_cache.sh
@@ -93,5 +89,5 @@ script:
9389
after_script:
9490
- echo "after_script start"
9591
- source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
96-
- ci/print_skipped.py
92+
- ci/print_skipped.py
9793
- echo "after_script done"

asv_bench/asv.conf.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"matplotlib": [],
4444
"sqlalchemy": [],
4545
"scipy": [],
46+
"numba": [],
4647
"numexpr": [],
4748
"pytables": [null, ""], // platform dependent, see excludes below
4849
"tables": [null, ""],

asv_bench/benchmarks/rolling.py

+21
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ def time_rolling(self, constructor, window, dtype, function, raw):
4444
self.roll.apply(function, raw=raw)
4545

4646

47+
class Engine:
48+
params = (
49+
["DataFrame", "Series"],
50+
["int", "float"],
51+
[np.sum, lambda x: np.sum(x) + 5],
52+
["cython", "numba"],
53+
)
54+
param_names = ["constructor", "dtype", "function", "engine"]
55+
56+
def setup(self, constructor, dtype, function, engine):
57+
N = 10 ** 3
58+
arr = (100 * np.random.random(N)).astype(dtype)
59+
self.data = getattr(pd, constructor)(arr)
60+
61+
def time_rolling_apply(self, constructor, dtype, function, engine):
62+
self.data.rolling(10).apply(function, raw=True, engine=engine)
63+
64+
def time_expanding_apply(self, constructor, dtype, function, engine):
65+
self.data.expanding().apply(function, raw=True, engine=engine)
66+
67+
4768
class ExpandingMethods:
4869

4970
params = (

ci/azure/posix.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
py36_minimum_versions:
1919
ENV_FILE: ci/deps/azure-36-minimum_versions.yaml
2020
CONDA_PY: "36"
21-
PATTERN: "not slow and not network"
21+
PATTERN: "not slow and not network and not clipboard"
2222

2323
py36_locale_slow_old_np:
2424
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
@@ -36,12 +36,12 @@ jobs:
3636
PATTERN: "not slow and not network"
3737
LANG: "it_IT.utf8"
3838
LC_ALL: "it_IT.utf8"
39-
EXTRA_APT: "language-pack-it"
39+
EXTRA_APT: "language-pack-it xsel"
4040

4141
py36_32bit:
4242
ENV_FILE: ci/deps/azure-36-32bit.yaml
4343
CONDA_PY: "36"
44-
PATTERN: "not slow and not network"
44+
PATTERN: "not slow and not network and not clipboard"
4545
BITS32: "yes"
4646

4747
py37_locale:
@@ -50,7 +50,7 @@ jobs:
5050
PATTERN: "not slow and not network"
5151
LANG: "zh_CN.utf8"
5252
LC_ALL: "zh_CN.utf8"
53-
EXTRA_APT: "language-pack-zh-hans"
53+
EXTRA_APT: "language-pack-zh-hans xsel"
5454

5555
py37_np_dev:
5656
ENV_FILE: ci/deps/azure-37-numpydev.yaml

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ fi
314314
### DOCSTRINGS ###
315315
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
316316

317-
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA01, SA02, SA03, SA05)' ; echo $MSG
318-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA01,SA02,SA03,SA05
317+
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03, SA05)' ; echo $MSG
318+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03,SA05
319319
RET=$(($RET + $?)) ; echo $MSG "DONE"
320320

321321
fi

ci/run_tests.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ if [ "$COVERAGE" ]; then
1414
COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME"
1515
fi
1616

17-
PYTEST_CMD="pytest -m \"$PATTERN\" -n auto --dist=loadfile -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
18-
19-
# Travis does not have have an X server
20-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
21-
DISPLAY=DISPLAY=:99.0
22-
PYTEST_CMD="xvfb-run -e /dev/stdout $PYTEST_CMD"
17+
# If no X server is found, we use xvfb to emulate it
18+
if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
19+
export DISPLAY=":0"
20+
XVFB="xvfb-run "
2321
fi
2422

23+
PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n auto --dist=loadfile -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
24+
2525
echo $PYTEST_CMD
2626
sh -c "$PYTEST_CMD"
2727

ci/setup_env.sh

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ echo "remove postgres if has been installed with conda"
114114
echo "we use the one from the CI"
115115
conda remove postgresql -y --force || true
116116

117+
echo
118+
echo "remove qt"
119+
echo "causes problems with the clipboard, we use xsel for that"
120+
conda remove qt -y --force || true
121+
117122
echo
118123
echo "conda list pandas"
119124
conda list pandas

doc/source/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
1212

13+
from datetime import datetime
1314
import importlib
1415
import inspect
1516
import logging
@@ -137,7 +138,7 @@
137138

138139
# General information about the project.
139140
project = "pandas"
140-
copyright = "2008-2014, the pandas development team"
141+
copyright = f"2008-{datetime.now().year}, the pandas development team"
141142

142143
# The version info for the project you're documenting, acts as replacement for
143144
# |version| and |release|, also used in various other places throughout the

doc/source/development/contributing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ About the *pandas* documentation
354354
--------------------------------
355355

356356
The documentation is written in **reStructuredText**, which is almost like writing
357-
in plain English, and built using `Sphinx <http://sphinx.pocoo.org/>`__. The
357+
in plain English, and built using `Sphinx <http://www.sphinx-doc.org/en/master/>`__. The
358358
Sphinx Documentation has an excellent `introduction to reST
359-
<http://sphinx.pocoo.org/rest.html>`__. Review the Sphinx docs to perform more
359+
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`__. Review the Sphinx docs to perform more
360360
complex changes to the documentation as well.
361361

362362
Some other important things to know about the docs:

doc/source/ecosystem.rst

+20-6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ Pyjanitor provides a clean API for cleaning data, using method chaining.
4141
Engarde is a lightweight library used to explicitly state assumptions about your datasets
4242
and check that they're *actually* true.
4343

44+
`pandas-path <https://github.com/drivendataorg/pandas-path/>`__
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46+
47+
Since Python 3.4, `pathlib <https://docs.python.org/3/library/pathlib.html>`_ has been
48+
included in the Python standard library. Path objects provide a simple
49+
and delightful way to interact with the file system. The pandas-path package enables the
50+
Path API for pandas through a custom accessor ``.path``. Getting just the filenames from
51+
a series of full file paths is as simple as ``my_files.path.name``. Other convenient operations like
52+
joining paths, replacing file extensions, and checking if files exist are also available.
53+
4454
.. _ecosystem.stats:
4555

4656
Statistics and machine learning
@@ -386,12 +396,16 @@ A directory of projects providing
386396
:ref:`extension accessors <extending.register-accessors>`. This is for users to
387397
discover new accessors and for library authors to coordinate on the namespace.
388398

389-
============== ========== =========================
390-
Library Accessor Classes
391-
============== ========== =========================
392-
`cyberpandas`_ ``ip`` ``Series``
393-
`pdvega`_ ``vgplot`` ``Series``, ``DataFrame``
394-
============== ========== =========================
399+
=============== ========== ========================= ===============================================================
400+
Library Accessor Classes Description
401+
=============== ========== ========================= ===============================================================
402+
`cyberpandas`_ ``ip`` ``Series`` Provides common operations for working with IP addresses.
403+
`pdvega`_ ``vgplot`` ``Series``, ``DataFrame`` Provides plotting functions from the Altair_ library.
404+
`pandas_path`_ ``path`` ``Index``, ``Series`` Provides `pathlib.Path`_ functions for Series.
405+
=============== ========== ========================= ===============================================================
395406

396407
.. _cyberpandas: https://cyberpandas.readthedocs.io/en/latest
397408
.. _pdvega: https://altair-viz.github.io/pdvega/
409+
.. _Altair: https://altair-viz.github.io/
410+
.. _pandas_path: https://github.com/drivendataorg/pandas-path/
411+
.. _pathlib.Path: https://docs.python.org/3/library/pathlib.html

doc/source/getting_started/dsintro.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Like a NumPy array, a pandas Series has a :attr:`~Series.dtype`.
136136
137137
This is often a NumPy dtype. However, pandas and 3rd-party libraries
138138
extend NumPy's type system in a few places, in which case the dtype would
139-
be a :class:`~pandas.api.extensions.ExtensionDtype`. Some examples within
139+
be an :class:`~pandas.api.extensions.ExtensionDtype`. Some examples within
140140
pandas are :ref:`categorical` and :ref:`integer_na`. See :ref:`basics.dtypes`
141141
for more.
142142

doc/source/user_guide/computation.rst

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ Numba will be applied in potentially two routines:
348348

349349
1. If ``func`` is a standard Python function, the engine will `JIT <http://numba.pydata.org/numba-doc/latest/user/overview.html>`__
350350
the passed function. ``func`` can also be a JITed function in which case the engine will not JIT the function again.
351+
351352
2. The engine will JIT the for loop where the apply function is applied to each window.
352353

353354
The ``engine_kwargs`` argument is a dictionary of keyword arguments that will be passed into the

doc/source/user_guide/missing_data.rst

+3-6
Original file line numberDiff line numberDiff line change
@@ -825,13 +825,10 @@ For example, ``pd.NA`` propagates in arithmetic operations, similarly to
825825
There are a few special cases when the result is known, even when one of the
826826
operands is ``NA``.
827827

828+
.. ipython:: python
828829
829-
================ ======
830-
Operation Result
831-
================ ======
832-
``pd.NA ** 0`` 0
833-
``1 ** pd.NA`` 1
834-
================ ======
830+
pd.NA ** 0
831+
1 ** pd.NA
835832
836833
In equality and comparison operations, ``pd.NA`` also propagates. This deviates
837834
from the behaviour of ``np.nan``, where comparisons with ``np.nan`` always

doc/source/whatsnew/v1.0.0.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ You can use the alias ``"boolean"`` as well.
159159
160160
.. _whatsnew_100.numba_rolling_apply:
161161

162-
Using Numba in ``rolling.apply``
163-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
162+
Using Numba in ``rolling.apply`` and ``expanding.apply``
163+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164164

165-
We've added an ``engine`` keyword to :meth:`~core.window.rolling.Rolling.apply` that allows the user to execute the
166-
routine using `Numba <https://numba.pydata.org/>`__ instead of Cython. Using the Numba engine
167-
can yield significant performance gains if the apply function can operate on numpy arrays and
165+
We've added an ``engine`` keyword to :meth:`~core.window.rolling.Rolling.apply` and :meth:`~core.window.expanding.Expanding.apply`
166+
that allows the user to execute the routine using `Numba <https://numba.pydata.org/>`__ instead of Cython.
167+
Using the Numba engine can yield significant performance gains if the apply function can operate on numpy arrays and
168168
the data set is larger (1 million rows or greater). For more details, see
169-
:ref:`rolling apply documentation <stats.rolling_apply>` (:issue:`28987`)
169+
:ref:`rolling apply documentation <stats.rolling_apply>` (:issue:`28987`, :issue:`30936`)
170170

171171
.. _whatsnew_100.custom_window:
172172

@@ -223,7 +223,7 @@ Other enhancements
223223
- :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` have gained ``ignore_index`` keyword to be able to reset index after sorting (:issue:`30114`)
224224
- :meth:`DataFrame.sort_index` and :meth:`Series.sort_index` have gained ``ignore_index`` keyword to reset index (:issue:`30114`)
225225
- :meth:`DataFrame.drop_duplicates` has gained ``ignore_index`` keyword to reset index (:issue:`30114`)
226-
- Added new writer for exporting Stata dta files in version 118, ``StataWriter118``. This format supports exporting strings containing Unicode characters (:issue:`23573`)
226+
- Added new writer for exporting Stata dta files in versions 118 and 119, ``StataWriterUTF8``. These files formats support exporting strings containing Unicode characters. Format 119 supports data sets with more than 32,767 variables (:issue:`23573`, :issue:`30959`)
227227
- :meth:`Series.map` now accepts ``collections.abc.Mapping`` subclasses as a mapper (:issue:`29733`)
228228
- Added an experimental :attr:`~DataFrame.attrs` for storing global metadata about a dataset (:issue:`29062`)
229229
- :meth:`Timestamp.fromisocalendar` is now compatible with python 3.8 and above (:issue:`28115`)

doc/source/whatsnew/v1.1.0.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Categorical
5959

6060
Datetimelike
6161
^^^^^^^^^^^^
62+
- Bug in :class:`Timestamp` where constructing :class:`Timestamp` from ambiguous epoch time and calling constructor again changed :meth:`Timestamp.value` property (:issue:`24329`)
6263
-
6364
-
6465

@@ -140,7 +141,7 @@ Reshaping
140141
^^^^^^^^^
141142

142143
-
143-
-
144+
- Bug in :meth:`DataFrame.pivot_table` when only MultiIndexed columns is set (:issue:`17038`)
144145

145146
Sparse
146147
^^^^^^

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ dependencies:
2727
# documentation
2828
- gitpython # obtain contributors from git for whatsnew
2929
- sphinx
30-
- numpydoc>=0.9.0
3130

3231
# documentation (jupyter notebooks)
3332
- nbconvert>=5.4.1
@@ -105,3 +104,4 @@ dependencies:
105104
- tabulate>=0.8.3 # DataFrame.to_markdown
106105
- pip:
107106
- git+https://github.com/pandas-dev/pandas-sphinx-theme.git@master
107+
- git+https://github.com/numpy/numpydoc

0 commit comments

Comments
 (0)