Skip to content

Commit 3d4b057

Browse files
committed
Merge branch 'master' into feature/groupby-repr-ellipses-1135
2 parents 6a7d7df + 3bbcacf commit 3d4b057

File tree

140 files changed

+2774
-1612
lines changed

Some content is hidden

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

140 files changed

+2774
-1612
lines changed

asv_bench/benchmarks/groupby.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
method_blacklist = {
1515
'object': {'median', 'prod', 'sem', 'cumsum', 'sum', 'cummin', 'mean',
1616
'max', 'skew', 'cumprod', 'cummax', 'rank', 'pct_change', 'min',
17-
'var', 'mad', 'describe', 'std'},
17+
'var', 'mad', 'describe', 'std', 'quantile'},
1818
'datetime': {'median', 'prod', 'sem', 'cumsum', 'sum', 'mean', 'skew',
1919
'cumprod', 'cummax', 'pct_change', 'var', 'mad', 'describe',
2020
'std'}
@@ -316,8 +316,9 @@ class GroupByMethods(object):
316316
['all', 'any', 'bfill', 'count', 'cumcount', 'cummax', 'cummin',
317317
'cumprod', 'cumsum', 'describe', 'ffill', 'first', 'head',
318318
'last', 'mad', 'max', 'min', 'median', 'mean', 'nunique',
319-
'pct_change', 'prod', 'rank', 'sem', 'shift', 'size', 'skew',
320-
'std', 'sum', 'tail', 'unique', 'value_counts', 'var'],
319+
'pct_change', 'prod', 'quantile', 'rank', 'sem', 'shift',
320+
'size', 'skew', 'std', 'sum', 'tail', 'unique', 'value_counts',
321+
'var'],
321322
['direct', 'transformation']]
322323

323324
def setup(self, dtype, method, application):

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ fi
241241
### DOCSTRINGS ###
242242
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
243243

244-
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, PR10, EX04, RT04, RT05, SS05, SA05)' ; echo $MSG
245-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,RT05,SS05,SA05
244+
MSG='Validate docstrings (GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG
245+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05
246246
RET=$(($RET + $?)) ; echo $MSG "DONE"
247247

248248
fi

ci/deps/azure-27-compat.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ dependencies:
1818
- xlsxwriter=0.5.2
1919
- xlwt=0.7.5
2020
# universal
21-
- pytest
21+
- pytest>=4.0.2
2222
- pytest-xdist
2323
- pytest-mock
24+
- isort
2425
- pip:
2526
- html5lib==1.0b2
2627
- beautifulsoup4==4.2.1

ci/deps/azure-27-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ dependencies:
2020
- xlsxwriter=0.5.2
2121
- xlwt=0.7.5
2222
# universal
23-
- pytest
23+
- pytest>=4.0.2
2424
- pytest-xdist
2525
- pytest-mock
2626
- hypothesis>=3.58.0
27+
- isort
2728
- pip:
2829
- html5lib==1.0b2
2930
- beautifulsoup4==4.2.1

ci/deps/azure-36-locale_slow.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ dependencies:
2626
- xlsxwriter
2727
- xlwt
2828
# universal
29-
- pytest
29+
- pytest>=4.0.2
3030
- pytest-xdist
3131
- pytest-mock
3232
- moto
33+
- isort
3334
- pip:
3435
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ dependencies:
2525
- xlsxwriter
2626
- xlwt
2727
# universal
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
31+
- isort
3132
- pip:
3233
- hypothesis>=3.58.0
3334
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/deps/azure-37-numpydev.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ dependencies:
66
- pytz
77
- Cython>=0.28.2
88
# universal
9-
- pytest
9+
- pytest>=4.0.2
1010
- pytest-xdist
1111
- pytest-mock
1212
- hypothesis>=3.58.0
13+
- isort
1314
- pip:
1415
- "git+git://github.com/dateutil/dateutil.git"
1516
- "-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"

ci/deps/azure-macos-35.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ dependencies:
2121
- xlrd
2222
- xlsxwriter
2323
- xlwt
24-
# universal
25-
- pytest
26-
- pytest-xdist
27-
- pytest-mock
24+
- isort
2825
- pip:
2926
- python-dateutil==2.5.3
27+
# universal
28+
- pytest>=4.0.2
29+
- pytest-xdist
30+
- pytest-mock
3031
- hypothesis>=3.58.0

ci/deps/azure-windows-27.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ dependencies:
2525
- xlwt
2626
# universal
2727
- cython>=0.28.2
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/azure-windows-36.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ dependencies:
2323
- xlwt
2424
# universal
2525
- cython>=0.28.2
26-
- pytest
26+
- pytest>=4.0.2
2727
- pytest-xdist
2828
- pytest-mock
2929
- hypothesis>=3.58.0
30+
- isort

ci/deps/travis-27.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ dependencies:
3939
- xlsxwriter=0.5.2
4040
- xlwt=0.7.5
4141
# universal
42-
- pytest
42+
- pytest>=4.0.2
4343
- pytest-xdist
4444
- pytest-mock
4545
- moto==1.3.4
4646
- hypothesis>=3.58.0
47+
- isort
4748
- pip:
4849
- backports.lzma
4950
- pandas-gbq

ci/deps/travis-36-doc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ dependencies:
4141
- xlsxwriter
4242
- xlwt
4343
# universal
44-
- pytest
44+
- pytest>=4.0.2
4545
- pytest-xdist
46+
- isort

ci/deps/travis-36-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ dependencies:
2828
- xlsxwriter
2929
- xlwt
3030
# universal
31-
- pytest
31+
- pytest>=4.0.2
3232
- pytest-xdist
3333
- pytest-mock
3434
- moto
35+
- isort
3536
- pip:
3637
- hypothesis>=3.58.0

ci/deps/travis-36-slow.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ dependencies:
2525
- xlsxwriter
2626
- xlwt
2727
# universal
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/travis-36.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ dependencies:
3333
- xlsxwriter
3434
- xlwt
3535
# universal
36-
- pytest
36+
- pytest>=4.0.2
3737
- pytest-xdist
3838
- pytest-cov
3939
- pytest-mock
4040
- hypothesis>=3.58.0
41+
- isort
4142
- pip:
4243
- brotlipy
4344
- coverage

ci/deps/travis-37.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ dependencies:
1212
- nomkl
1313
- pyarrow
1414
- pytz
15-
- pytest
15+
- pytest>=4.0.2
1616
- pytest-xdist
1717
- pytest-mock
1818
- hypothesis>=3.58.0
1919
- s3fs
20+
- isort
2021
- pip:
2122
- moto

doc/make.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,16 @@ def main():
294294
help='number of jobs used by sphinx-build')
295295
argparser.add_argument('--no-api',
296296
default=False,
297-
help='ommit api and autosummary',
297+
help='omit api and autosummary',
298298
action='store_true')
299299
argparser.add_argument('--single',
300300
metavar='FILENAME',
301301
type=str,
302302
default=None,
303-
help=('filename of section or method name to '
304-
'compile, e.g. "indexing", "DataFrame.join"'))
303+
help=('filename (relative to the "source" folder)'
304+
' of section or method name to compile, e.g. '
305+
'"development/contributing.rst",'
306+
' "ecosystem.rst", "pandas.DataFrame.join"'))
305307
argparser.add_argument('--python-path',
306308
type=str,
307309
default=os.path.dirname(DOC_PATH),
@@ -323,7 +325,7 @@ def main():
323325
# the import of `python_path` correctly. The latter is used to resolve
324326
# the import within the module, injecting it into the global namespace
325327
os.environ['PYTHONPATH'] = args.python_path
326-
sys.path.append(args.python_path)
328+
sys.path.insert(0, args.python_path)
327329
globals()['pandas'] = importlib.import_module('pandas')
328330

329331
# Set the matplotlib backend to the non-interactive Agg backend for all

doc/source/development/contributing.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ We'll now kick off a three-step process:
178178
# Create and activate the build environment
179179
conda env create -f environment.yml
180180
conda activate pandas-dev
181+
conda uninstall --force pandas
181182
182183
# or with older versions of Anaconda:
183184
source activate pandas-dev
@@ -428,14 +429,14 @@ reducing the turn-around time for checking your changes.
428429
python make.py clean
429430
python make.py --no-api
430431

431-
# compile the docs with only a single
432-
# section, that which is in indexing.rst
432+
# compile the docs with only a single section, relative to the "source" folder.
433+
# For example, compiling only this guide (docs/source/development/contributing.rst)
433434
python make.py clean
434-
python make.py --single indexing
435+
python make.py --single development/contributing.rst
435436

436437
# compile the reference docs for a single function
437438
python make.py clean
438-
python make.py --single DataFrame.join
439+
python make.py --single pandas.DataFrame.join
439440

440441
For comparison, a full documentation build may take 15 minutes, but a single
441442
section may take 15 seconds. Subsequent builds, which only process portions
@@ -731,7 +732,7 @@ extensions in `numpy.testing
731732

732733
.. note::
733734

734-
The earliest supported pytest version is 3.6.0.
735+
The earliest supported pytest version is 4.0.2.
735736

736737
Writing tests
737738
~~~~~~~~~~~~~

doc/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pandas is equipped with an exhaustive set of unit tests, covering about 97% of
202202
the code base as of this writing. To run it on your machine to verify that
203203
everything is working (and that you have all of the dependencies, soft and hard,
204204
installed), make sure you have `pytest
205-
<http://docs.pytest.org/en/latest/>`__ >= 3.6 and `Hypothesis
205+
<http://docs.pytest.org/en/latest/>`__ >= 4.0.2 and `Hypothesis
206206
<https://hypothesis.readthedocs.io/>`__ >= 3.58, then run:
207207

208208
::

doc/source/reference/groupby.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ application to columns of a specific data type.
9999
DataFrameGroupBy.idxmax
100100
DataFrameGroupBy.idxmin
101101
DataFrameGroupBy.mad
102+
DataFrameGroupBy.nunique
102103
DataFrameGroupBy.pct_change
103104
DataFrameGroupBy.plot
104105
DataFrameGroupBy.quantile

doc/source/reference/series.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ strings and apply several methods to it. These can be accessed like
409409
:template: autosummary/accessor_method.rst
410410

411411
Series.str.capitalize
412+
Series.str.casefold
412413
Series.str.cat
413414
Series.str.center
414415
Series.str.contains

doc/source/user_guide/indexing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ Selection By Position
435435
This is sometimes called ``chained assignment`` and should be avoided.
436436
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`.
437437

438-
Pandas provides a suite of methods in order to get **purely integer based indexing**. The semantics follow closely Python and NumPy slicing. These are ``0-based`` indexing. When slicing, the start bounds is *included*, while the upper bound is *excluded*. Trying to use a non-integer, even a **valid** label will raise an ``IndexError``.
438+
Pandas provides a suite of methods in order to get **purely integer based indexing**. The semantics follow closely Python and NumPy slicing. These are ``0-based`` indexing. When slicing, the start bound is *included*, while the upper bound is *excluded*. Trying to use a non-integer, even a **valid** label will raise an ``IndexError``.
439439

440440
The ``.iloc`` attribute is the primary access method. The following are valid inputs:
441441

@@ -545,7 +545,7 @@ Selection By Callable
545545
.. versionadded:: 0.18.1
546546

547547
``.loc``, ``.iloc``, and also ``[]`` indexing can accept a ``callable`` as indexer.
548-
The ``callable`` must be a function with one argument (the calling Series, DataFrame or Panel) and that returns valid output for indexing.
548+
The ``callable`` must be a function with one argument (the calling Series, DataFrame or Panel) that returns valid output for indexing.
549549

550550
.. ipython:: python
551551
@@ -569,7 +569,7 @@ You can use callable indexing in ``Series``.
569569
df1.A.loc[lambda s: s > 0]
570570
571571
Using these methods / indexers, you can chain data selection operations
572-
without using temporary variable.
572+
without using a temporary variable.
573573

574574
.. ipython:: python
575575
@@ -907,7 +907,7 @@ of the DataFrame):
907907
908908
df[df['A'] > 0]
909909
910-
List comprehensions and ``map`` method of Series can also be used to produce
910+
List comprehensions and the ``map`` method of Series can also be used to produce
911911
more complex criteria:
912912

913913
.. ipython:: python
@@ -1556,7 +1556,7 @@ See :ref:`Advanced Indexing <advanced>` for usage of MultiIndexes.
15561556
ind
15571557
15581558
``set_names``, ``set_levels``, and ``set_codes`` also take an optional
1559-
`level`` argument
1559+
``level`` argument
15601560

15611561
.. ipython:: python
15621562

doc/source/user_guide/text.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ Method Summary
600600
:meth:`~Series.str.partition`;Equivalent to ``str.partition``
601601
:meth:`~Series.str.rpartition`;Equivalent to ``str.rpartition``
602602
:meth:`~Series.str.lower`;Equivalent to ``str.lower``
603+
:meth:`~Series.str.casefold`;Equivalent to ``str.casefold``
603604
:meth:`~Series.str.upper`;Equivalent to ``str.upper``
604605
:meth:`~Series.str.find`;Equivalent to ``str.find``
605606
:meth:`~Series.str.rfind`;Equivalent to ``str.rfind``

doc/source/whatsnew/v0.24.2.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ Fixed Regressions
2323
- Fixed regression in :meth:`DataFrame.all` and :meth:`DataFrame.any` where ``bool_only=True`` was ignored (:issue:`25101`)
2424
- Fixed issue in ``DataFrame`` construction with passing a mixed list of mixed types could segfault. (:issue:`25075`)
2525
- Fixed regression in :meth:`DataFrame.apply` causing ``RecursionError`` when ``dict``-like classes were passed as argument. (:issue:`25196`)
26+
- Fixed regression in :meth:`DataFrame.replace` where ``regex=True`` was only replacing patterns matching the start of the string (:issue:`25259`)
2627

2728
- Fixed regression in :meth:`DataFrame.duplicated()`, where empty dataframe was not returning a boolean dtyped Series. (:issue:`25184`)
2829
- Fixed regression in :meth:`Series.min` and :meth:`Series.max` where ``numeric_only=True`` was ignored when the ``Series`` contained ```Categorical`` data (:issue:`25299`)
2930
- Fixed regression in subtraction between :class:`Series` objects with ``datetime64[ns]`` dtype incorrectly raising ``OverflowError`` when the `Series` on the right contains null values (:issue:`25317`)
3031
- Fixed regression in :class:`TimedeltaIndex` where `np.sum(index)` incorrectly returned a zero-dimensional object instead of a scalar (:issue:`25282`)
3132
- Fixed regression in ``IntervalDtype`` construction where passing an incorrect string with 'Interval' as a prefix could result in a ``RecursionError``. (:issue:`25338`)
3233

34+
- Fixed regression in :class:`Categorical`, where constructing it from a categorical ``Series`` and an explicit ``categories=`` that differed from that in the ``Series`` created an invalid object which could trigger segfaults. (:issue:`25318`)
35+
3336
.. _whatsnew_0242.enhancements:
3437

3538
Enhancements
@@ -97,6 +100,7 @@ Bug Fixes
97100

98101
- Bug in :meth:`Series.is_unique` where single occurrences of ``NaN`` were not considered unique (:issue:`25180`)
99102
- Bug in :func:`merge` when merging an empty ``DataFrame`` with an ``Int64`` column or a non-empty ``DataFrame`` with an ``Int64`` column that is all ``NaN`` (:issue:`25183`)
103+
- Bug in ``IntervalTree`` where a ``RecursionError`` occurs upon construction due to an overflow when adding endpoints, which also causes :class:`IntervalIndex` to crash during indexing operations (:issue:`25485`)
100104
-
101105

102106
.. _whatsnew_0.242.contributors:

0 commit comments

Comments
 (0)