Skip to content

Commit 041d1b5

Browse files
author
MomIsBestFriend
committed
Merge remote-tracking branch 'upstream/master' into TST-bare-pytest-raises-1
2 parents 1416011 + 0f04c6a commit 041d1b5

File tree

35 files changed

+391
-317
lines changed

35 files changed

+391
-317
lines changed

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 = (

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-2020, 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/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/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/whatsnew/v1.0.0.rst

+6-6
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

0 commit comments

Comments
 (0)