Skip to content

Commit d1a635d

Browse files
Merge remote-tracking branch 'upstream/master' into bisect
2 parents 69073c6 + 82cd86c commit d1a635d

File tree

421 files changed

+9123
-10014
lines changed

Some content is hidden

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

421 files changed

+9123
-10014
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Update pre-commit config"
2+
3+
on:
4+
schedule:
5+
- cron: "0 7 * * 1" # At 07:00 on each Monday.
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-pre-commit:
10+
if: github.repository_owner == 'pandas-dev'
11+
name: Autoupdate pre-commit config
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
- name: Cache multiple paths
17+
uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/.cache/pre-commit
21+
~/.cache/pip
22+
key: pre-commit-autoupdate-${{ runner.os }}-build
23+
- name: Update pre-commit config packages
24+
uses: technote-space/create-pr-action@v2
25+
with:
26+
GITHUB_TOKEN: ${{ secrets.ACTION_TRIGGER_TOKEN }}
27+
EXECUTE_COMMANDS: |
28+
pip install pre-commit
29+
pre-commit autoupdate || (exit 0);
30+
pre-commit run -a || (exit 0);
31+
COMMIT_MESSAGE: "⬆️ UPGRADE: Autoupdate pre-commit config"
32+
PR_BRANCH_NAME: "pre-commit-config-update-${PR_ID}"
33+
PR_TITLE: "⬆️ UPGRADE: Autoupdate pre-commit config"

.pre-commit-config.yaml

+51-7
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ repos:
1818
types: [text]
1919
args: [--append-config=flake8/cython-template.cfg]
2020
- repo: https://github.com/PyCQA/isort
21-
rev: 5.6.3
21+
rev: 5.6.4
2222
hooks:
2323
- id: isort
2424
name: isort (python)
2525
- id: isort
2626
name: isort (cython)
2727
types: [cython]
2828
- repo: https://github.com/asottile/pyupgrade
29-
rev: v2.7.2
29+
rev: v2.7.3
3030
hooks:
3131
- id: pyupgrade
3232
args: [--py37-plus]
@@ -66,9 +66,17 @@ repos:
6666
from\ pandas\.core\ import\ common|
6767
6868
# Check for imports from collections.abc instead of `from collections import abc`
69-
from\ collections\.abc\ import|
69+
from\ collections\.abc\ import
7070
71-
from\ numpy\ import\ nan
71+
- id: non-standard-numpy.random-related-imports
72+
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
73+
language: pygrep
74+
exclude: pandas/_testing.py
75+
entry: |
76+
(?x)
77+
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
78+
from\ numpy\ import\ random|
79+
from\ numpy.random\ import
7280
types: [python]
7381
- id: non-standard-imports-in-tests
7482
name: Check for non-standard imports in test suite
@@ -104,19 +112,55 @@ repos:
104112
language: python
105113
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
106114
types: [python]
107-
exclude: ^(asv_bench|pandas/_vendored|pandas/tests|doc)/
115+
exclude: ^(asv_bench|pandas/tests|doc)/
108116
- id: unwanted-patterns-private-function-across-module
109117
name: Check for use of private functions across modules
110118
language: python
111119
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
112120
types: [python]
113-
exclude: ^(asv_bench|pandas/_vendored|pandas/tests|doc)/
121+
exclude: ^(asv_bench|pandas/tests|doc)/
122+
- id: inconsistent-namespace-usage
123+
name: 'Check for inconsistent use of pandas namespace in tests'
124+
entry: python scripts/check_for_inconsistent_pandas_namespace.py
125+
language: python
126+
types: [python]
127+
files: ^pandas/tests/
128+
- id: FrameOrSeriesUnion
129+
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
130+
entry: Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]
131+
language: pygrep
132+
types: [python]
133+
exclude: ^pandas/_typing\.py$
134+
- id: type-not-class
135+
name: Check for use of foo.__class__ instead of type(foo)
136+
entry: \.__class__
137+
language: pygrep
138+
files: \.(py|pyx)$
139+
- id: unwanted-typing
140+
name: Check for use of comment-based annotation syntax and missing error codes
141+
entry: |
142+
(?x)
143+
\#\ type:\ (?!ignore)|
144+
\#\ type:\s?ignore(?!\[)
145+
language: pygrep
146+
types: [python]
147+
- id: no-os-remove
148+
name: Check code for instances of os.remove
149+
entry: os\.remove
150+
language: pygrep
151+
types: [python]
152+
files: ^pandas/tests/
153+
exclude: |
154+
(?x)^
155+
pandas/tests/io/excel/test_writers\.py|
156+
pandas/tests/io/pytables/common\.py|
157+
pandas/tests/io/pytables/test_store\.py$
114158
- repo: https://github.com/asottile/yesqa
115159
rev: v1.2.2
116160
hooks:
117161
- id: yesqa
118162
- repo: https://github.com/pre-commit/pre-commit-hooks
119-
rev: v3.2.0
163+
rev: v3.3.0
120164
hooks:
121165
- id: end-of-file-fixer
122166
exclude: ^LICENSES/|\.(html|csv|txt|svg|py)$

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ check:
3030
python3 scripts/validate_unwanted_patterns.py \
3131
--validation-type="private_function_across_module" \
3232
--included-file-extensions="py" \
33-
--excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored \
33+
--excluded-file-paths=pandas/tests,asv_bench/ \
3434
pandas/
3535

3636
python3 scripts/validate_unwanted_patterns.py \
3737
--validation-type="private_import_across_module" \
3838
--included-file-extensions="py" \
39-
--excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored,doc/
39+
--excluded-file-paths=pandas/tests,asv_bench/,doc/
4040
pandas/

ci/azure/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
py38_np18:
1717
ENV_FILE: ci/deps/azure-windows-38.yaml
1818
CONDA_PY: "38"
19-
PATTERN: "not slow and not network"
19+
PATTERN: "not slow and not network and not high_memory"
2020

2121
steps:
2222
- powershell: |

ci/code_checks.sh

-36
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ function invgrep {
3737
return $((! $EXIT_STATUS))
3838
}
3939

40-
function check_namespace {
41-
local -r CLASS="${1}"
42-
grep -R -l --include "*.py" " ${CLASS}(" pandas/tests | xargs grep -n "pd\.${CLASS}("
43-
test $? -gt 0
44-
}
45-
4640
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
4741
FLAKE8_FORMAT="##[error]%(path)s:%(row)s:%(col)s:%(code)s:%(text)s"
4842
INVGREP_PREPEND="##[error]"
@@ -120,36 +114,6 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
120114
MSG='Check for use of {foo!r} instead of {repr(foo)}' ; echo $MSG
121115
invgrep -R --include=*.{py,pyx} '!r}' pandas
122116
RET=$(($RET + $?)) ; echo $MSG "DONE"
123-
124-
# -------------------------------------------------------------------------
125-
# Type annotations
126-
127-
MSG='Check for use of comment-based annotation syntax' ; echo $MSG
128-
invgrep -R --include="*.py" -P '# type: (?!ignore)' pandas
129-
RET=$(($RET + $?)) ; echo $MSG "DONE"
130-
131-
MSG='Check for missing error codes with # type: ignore' ; echo $MSG
132-
invgrep -R --include="*.py" -P '# type:\s?ignore(?!\[)' pandas
133-
RET=$(($RET + $?)) ; echo $MSG "DONE"
134-
135-
MSG='Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias' ; echo $MSG
136-
invgrep -R --include="*.py" --exclude=_typing.py -E 'Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]' pandas
137-
RET=$(($RET + $?)) ; echo $MSG "DONE"
138-
139-
# -------------------------------------------------------------------------
140-
MSG='Check for use of foo.__class__ instead of type(foo)' ; echo $MSG
141-
invgrep -R --include=*.{py,pyx} '\.__class__' pandas
142-
RET=$(($RET + $?)) ; echo $MSG "DONE"
143-
144-
MSG='Check code for instances of os.remove' ; echo $MSG
145-
invgrep -R --include="*.py*" --exclude "common.py" --exclude "test_writers.py" --exclude "test_store.py" -E "os\.remove" pandas/tests/
146-
RET=$(($RET + $?)) ; echo $MSG "DONE"
147-
148-
MSG='Check for inconsistent use of pandas namespace in tests' ; echo $MSG
149-
for class in "Series" "DataFrame" "Index"; do
150-
check_namespace ${class}
151-
RET=$(($RET + $?))
152-
done
153117
echo $MSG "DONE"
154118
fi
155119

ci/run_tests.sh

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ fi
2222

2323
PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile -s --strict --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
2424

25+
if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then
26+
# GH#37455 windows py38 build appears to be running out of memory
27+
# skip collection of window tests
28+
PYTEST_CMD="$PYTEST_CMD --ignore=pandas/tests/window/"
29+
fi
30+
2531
echo $PYTEST_CMD
2632
sh -c "$PYTEST_CMD"
2733

doc/source/development/contributing.rst

+8-2
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,14 @@ to run its checks by running::
837837

838838
without having to have done ``pre-commit install`` beforehand.
839839

840-
Note that if you have conflicting installations of ``virtualenv``, then you may get an
841-
error - see `here <https://github.com/pypa/virtualenv/issues/1875>`_.
840+
.. note::
841+
842+
If you have conflicting installations of ``virtualenv``, then you may get an
843+
error - see `here <https://github.com/pypa/virtualenv/issues/1875>`_.
844+
845+
Also, due to a `bug in virtualenv <https://github.com/pypa/virtualenv/issues/1986>`_,
846+
you may run into issues if you're using conda. To solve this, you can downgrade
847+
``virtualenv`` to version ``20.0.33``.
842848

843849
Backwards compatibility
844850
~~~~~~~~~~~~~~~~~~~~~~~

doc/source/user_guide/computation.rst

+4
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ The list of recognized types are the `scipy.signal window functions
451451
* ``slepian`` (needs width)
452452
* ``exponential`` (needs tau).
453453

454+
.. versionadded:: 1.2.0
455+
456+
All Scipy window types, concurrent with your installed version, are recognized ``win_types``.
457+
454458
.. ipython:: python
455459
456460
ser = pd.Series(np.random.randn(10), index=pd.date_range("1/1/2000", periods=10))

doc/source/user_guide/indexing.rst

+15-8
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,17 @@ above example, ``s.loc[1:6]`` would raise ``KeyError``.
422422
For the rationale behind this behavior, see
423423
:ref:`Endpoints are inclusive <advanced.endpoints_are_inclusive>`.
424424

425+
.. ipython:: python
426+
427+
s = pd.Series(list('abcdef'), index=[0, 3, 2, 5, 4, 2])
428+
s.loc[3:5]
429+
430+
Also, if the index has duplicate labels *and* either the start or the stop label is dupulicated,
431+
an error will be raised. For instance, in the above example, ``s.loc[2:5]`` would raise a ``KeyError``.
432+
433+
For more information about duplicate labels, see
434+
:ref:`Duplicate Labels <duplicates>`.
435+
425436
.. _indexing.integer:
426437

427438
Selection by position
@@ -1594,19 +1605,16 @@ See :ref:`Advanced Indexing <advanced>` for usage of MultiIndexes.
15941605
Set operations on Index objects
15951606
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15961607

1597-
The two main operations are ``union (|)`` and ``intersection (&)``.
1598-
These can be directly called as instance methods or used via overloaded
1599-
operators. Difference is provided via the ``.difference()`` method.
1608+
The two main operations are ``union`` and ``intersection``.
1609+
Difference is provided via the ``.difference()`` method.
16001610

16011611
.. ipython:: python
16021612
16031613
a = pd.Index(['c', 'b', 'a'])
16041614
b = pd.Index(['c', 'e', 'd'])
1605-
a | b
1606-
a & b
16071615
a.difference(b)
16081616
1609-
Also available is the ``symmetric_difference (^)`` operation, which returns elements
1617+
Also available is the ``symmetric_difference`` operation, which returns elements
16101618
that appear in either ``idx1`` or ``idx2``, but not in both. This is
16111619
equivalent to the Index created by ``idx1.difference(idx2).union(idx2.difference(idx1))``,
16121620
with duplicates dropped.
@@ -1616,7 +1624,6 @@ with duplicates dropped.
16161624
idx1 = pd.Index([1, 2, 3, 4])
16171625
idx2 = pd.Index([2, 3, 4, 5])
16181626
idx1.symmetric_difference(idx2)
1619-
idx1 ^ idx2
16201627
16211628
.. note::
16221629

@@ -1631,7 +1638,7 @@ integer values are converted to float
16311638
16321639
idx1 = pd.Index([0, 1, 2])
16331640
idx2 = pd.Index([0.5, 1.5])
1634-
idx1 | idx2
1641+
idx1.union(idx2)
16351642
16361643
.. _indexing.missing:
16371644

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
ser = pd.Series(np.sort(np.random.uniform(size=100)))
467467
468468
# interpolate at new_index
469-
new_index = ser.index | pd.Index([49.25, 49.5, 49.75, 50.25, 50.5, 50.75])
469+
new_index = ser.index.union(pd.Index([49.25, 49.5, 49.75, 50.25, 50.5, 50.75]))
470470
interp_s = ser.reindex(new_index).interpolate(method="pchip")
471471
interp_s[49:51]
472472

doc/source/user_guide/timeseries.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ into ``freq`` keyword arguments. The available date offsets and associated frequ
879879
:header: "Date Offset", "Frequency String", "Description"
880880
:widths: 15, 15, 65
881881

882-
:class:`~pandas.tseries.offsets.DateOffset`, None, "Generic offset class, defaults to 1 calendar day"
882+
:class:`~pandas.tseries.offsets.DateOffset`, None, "Generic offset class, defaults to absolute 24 hours"
883883
:class:`~pandas.tseries.offsets.BDay` or :class:`~pandas.tseries.offsets.BusinessDay`, ``'B'``,"business day (weekday)"
884884
:class:`~pandas.tseries.offsets.CDay` or :class:`~pandas.tseries.offsets.CustomBusinessDay`, ``'C'``, "custom business day"
885885
:class:`~pandas.tseries.offsets.Week`, ``'W'``, "one week, optionally anchored on a day of the week"

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 1.1
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v1.1.5
2728
v1.1.4
2829
v1.1.3
2930
v1.1.2

doc/source/whatsnew/v1.1.4.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ Bug fixes
5252
Contributors
5353
~~~~~~~~~~~~
5454

55-
.. contributors:: v1.1.3..v1.1.4|HEAD
55+
.. contributors:: v1.1.3..v1.1.4

doc/source/whatsnew/v1.1.5.rst

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _whatsnew_115:
2+
3+
What's new in 1.1.5 (??)
4+
------------------------
5+
6+
These are the changes in pandas 1.1.5. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
13+
.. _whatsnew_115.regressions:
14+
15+
Fixed regressions
16+
~~~~~~~~~~~~~~~~~
17+
-
18+
-
19+
20+
.. ---------------------------------------------------------------------------
21+
22+
.. _whatsnew_115.bug_fixes:
23+
24+
Bug fixes
25+
~~~~~~~~~
26+
- Bug in metadata propagation for ``groupby`` iterator (:issue:`37343`)
27+
- Bug in indexing on a :class:`Series` with ``CategoricalDtype`` after unpickling (:issue:`37631`)
28+
-
29+
30+
.. ---------------------------------------------------------------------------
31+
32+
.. _whatsnew_115.contributors:
33+
34+
Contributors
35+
~~~~~~~~~~~~
36+
37+
.. contributors:: v1.1.4..v1.1.5|HEAD

0 commit comments

Comments
 (0)