Skip to content

Commit c43ce3b

Browse files
committed
Merge branch 'master' into mypy/arraylike
2 parents 9f32b93 + a427887 commit c43ce3b

File tree

558 files changed

+28734
-21845
lines changed

Some content is hidden

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

558 files changed

+28734
-21845
lines changed

.github/ISSUE_TEMPLATE/documentation_improvement.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ labels: "Docs, Needs Triage"
99

1010
#### Location of the documentation
1111

12-
[this should provide the location of the documentation, e.g. "pandas.read_csv" or the URL of the documentation, e.g. "https://dev.pandas.io/docs/reference/api/pandas.read_csv.html"]
12+
[this should provide the location of the documentation, e.g. "pandas.read_csv" or the URL of the documentation, e.g. "https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html"]
1313

1414
**Note**: You can check the latest versions of the docs on `master` [here](https://pandas.pydata.org/docs/dev/).
1515

.github/workflows/ci.yml

+53-28
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,81 @@ name: CI
22

33
on:
44
push:
5-
branches: master
5+
branches: [master]
66
pull_request:
77
branches:
88
- master
99
- 1.2.x
1010

1111
env:
1212
ENV_FILE: environment.yml
13+
PANDAS_CI: 1
1314

1415
jobs:
1516
checks:
1617
name: Checks
1718
runs-on: ubuntu-latest
18-
steps:
19-
20-
- name: Setting conda path
21-
run: echo "${HOME}/miniconda3/bin" >> $GITHUB_PATH
19+
defaults:
20+
run:
21+
shell: bash -l {0}
2222

23+
steps:
2324
- name: Checkout
2425
uses: actions/checkout@v1
2526

2627
- name: Looking for unwanted patterns
2728
run: ci/code_checks.sh patterns
2829
if: always()
2930

30-
- name: Setup environment and build pandas
31-
run: ci/setup_env.sh
32-
if: always()
31+
- name: Cache conda
32+
uses: actions/cache@v2
33+
with:
34+
path: ~/conda_pkgs_dir
35+
key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }}
3336

34-
- name: Linting
37+
- uses: conda-incubator/setup-miniconda@v2
38+
with:
39+
activate-environment: pandas-dev
40+
channel-priority: strict
41+
environment-file: ${{ env.ENV_FILE }}
42+
use-only-tar-bz2: true
43+
44+
- name: Environment Detail
3545
run: |
36-
source activate pandas-dev
37-
ci/code_checks.sh lint
46+
conda info
47+
conda list
48+
49+
- name: Build Pandas
50+
run: |
51+
python setup.py build_ext -j 2
52+
python -m pip install -e . --no-build-isolation --no-use-pep517
53+
54+
- name: Linting
55+
run: ci/code_checks.sh lint
3856
if: always()
3957

4058
- name: Checks on imported code
41-
run: |
42-
source activate pandas-dev
43-
ci/code_checks.sh code
59+
run: ci/code_checks.sh code
4460
if: always()
4561

4662
- name: Running doctests
47-
run: |
48-
source activate pandas-dev
49-
ci/code_checks.sh doctests
63+
run: ci/code_checks.sh doctests
5064
if: always()
5165

5266
- name: Docstring validation
53-
run: |
54-
source activate pandas-dev
55-
ci/code_checks.sh docstrings
67+
run: ci/code_checks.sh docstrings
5668
if: always()
5769

5870
- name: Typing validation
59-
run: |
60-
source activate pandas-dev
61-
ci/code_checks.sh typing
71+
run: ci/code_checks.sh typing
6272
if: always()
6373

6474
- name: Testing docstring validation script
65-
run: |
66-
source activate pandas-dev
67-
pytest --capture=no --strict-markers scripts
75+
run: pytest --capture=no --strict-markers scripts
6876
if: always()
6977

7078
- name: Running benchmarks
7179
run: |
72-
source activate pandas-dev
7380
cd asv_bench
7481
asv check -E existing
7582
git remote add upstream https://github.com/pandas-dev/pandas.git
@@ -106,7 +113,6 @@ jobs:
106113
run: |
107114
source activate pandas-dev
108115
python web/pandas_web.py web/pandas --target-path=web/build
109-
110116
- name: Build documentation
111117
run: |
112118
source activate pandas-dev
@@ -132,3 +138,22 @@ jobs:
132138
- name: Upload dev docs
133139
run: rsync -az --delete doc/build/html/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas/pandas-docs/dev
134140
if: github.event_name == 'push'
141+
142+
data_manager:
143+
name: Test experimental data manager
144+
runs-on: ubuntu-latest
145+
steps:
146+
147+
- name: Setting conda path
148+
run: echo "${HOME}/miniconda3/bin" >> $GITHUB_PATH
149+
150+
- name: Checkout
151+
uses: actions/checkout@v1
152+
153+
- name: Setup environment and build pandas
154+
run: ci/setup_env.sh
155+
156+
- name: Run tests
157+
run: |
158+
source activate pandas-dev
159+
pytest pandas/tests/frame/methods --array-manager

.github/workflows/comment_bot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install-pre-commit
3030
run: python -m pip install --upgrade pre-commit
3131
- name: Run pre-commit
32-
run: pre-commit run --all-files || (exit 0)
32+
run: pre-commit run --from-ref=origin/master --to-ref=HEAD --all-files || (exit 0)
3333
- name: Commit results
3434
run: |
3535
git config user.name "$(git log -1 --pretty=format:%an)"

.pre-commit-config.yaml

+43-21
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ repos:
2424
hooks:
2525
- id: isort
2626
- repo: https://github.com/asottile/pyupgrade
27-
rev: v2.7.4
27+
rev: v2.10.0
2828
hooks:
2929
- id: pyupgrade
30-
args: [--py37-plus]
30+
args: [--py37-plus, --keep-runtime-typing]
3131
- repo: https://github.com/pre-commit/pygrep-hooks
32-
rev: v1.7.0
32+
rev: v1.7.1
3333
hooks:
3434
- id: rst-backticks
3535
- id: rst-directive-colons
@@ -60,11 +60,11 @@ repos:
6060
entry: |
6161
(?x)
6262
# Check for imports from pandas.core.common instead of `import pandas.core.common as com`
63-
from\ pandas\.core\.common\ import|
64-
from\ pandas\.core\ import\ common|
63+
from\ pandas\.core\.common\ import
64+
|from\ pandas\.core\ import\ common
6565
6666
# Check for imports from collections.abc instead of `from collections import abc`
67-
from\ collections\.abc\ import
67+
|from\ collections\.abc\ import
6868
6969
- id: non-standard-numpy.random-related-imports
7070
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
@@ -73,24 +73,24 @@ repos:
7373
entry: |
7474
(?x)
7575
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
76-
from\ numpy\ import\ random|
77-
from\ numpy.random\ import
76+
from\ numpy\ import\ random
77+
|from\ numpy.random\ import
7878
types: [python]
7979
- id: non-standard-imports-in-tests
8080
name: Check for non-standard imports in test suite
8181
language: pygrep
8282
entry: |
8383
(?x)
8484
# Check for imports from pandas._testing instead of `import pandas._testing as tm`
85-
from\ pandas\._testing\ import|
86-
from\ pandas\ import\ _testing\ as\ tm|
85+
from\ pandas\._testing\ import
86+
|from\ pandas\ import\ _testing\ as\ tm
8787
8888
# No direct imports from conftest
89-
conftest\ import|
90-
import\ conftest
89+
|conftest\ import
90+
|import\ conftest
9191
9292
# Check for use of pandas.testing instead of tm
93-
pd\.testing\.
93+
|pd\.testing\.
9494
types: [python]
9595
files: ^pandas/tests/
9696
- id: incorrect-code-directives
@@ -127,6 +127,12 @@ repos:
127127
types: [python]
128128
files: ^pandas/tests/
129129
exclude: ^pandas/tests/extension/
130+
- id: unwanted-patters-pytest-xfail
131+
name: Check for use of pytest.xfail
132+
entry: pytest\.xfail
133+
language: pygrep
134+
types: [python]
135+
files: ^pandas/tests/
130136
- id: inconsistent-namespace-usage
131137
name: 'Check for inconsistent use of pandas namespace in tests'
132138
entry: python scripts/check_for_inconsistent_pandas_namespace.py
@@ -135,7 +141,7 @@ repos:
135141
files: ^pandas/tests/
136142
- id: FrameOrSeriesUnion
137143
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
138-
entry: Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]
144+
entry: Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
139145
language: pygrep
140146
types: [python]
141147
exclude: ^pandas/_typing\.py$
@@ -145,11 +151,11 @@ repos:
145151
language: pygrep
146152
types_or: [python, cython]
147153
- id: unwanted-typing
148-
name: Check for use of comment-based annotation syntax and missing error codes
154+
name: Check for outdated annotation syntax and missing error codes
149155
entry: |
150156
(?x)
151-
\#\ type:\ (?!ignore)|
152-
\#\ type:\s?ignore(?!\[)
157+
\#\ type:\ (?!ignore)
158+
|\#\ type:\s?ignore(?!\[)
153159
language: pygrep
154160
types: [python]
155161
- id: np-bool
@@ -165,9 +171,15 @@ repos:
165171
files: ^pandas/tests/
166172
exclude: |
167173
(?x)^
168-
pandas/tests/io/excel/test_writers\.py|
169-
pandas/tests/io/pytables/common\.py|
170-
pandas/tests/io/pytables/test_store\.py$
174+
pandas/tests/io/excel/test_writers\.py
175+
|pandas/tests/io/pytables/common\.py
176+
|pandas/tests/io/pytables/test_store\.py$
177+
- id: no-pandas-api-types
178+
name: Check code for instances of pd.api.types
179+
entry: (pd|pandas)\.api\.types\.
180+
language: pygrep
181+
types: [python]
182+
files: ^pandas/tests/
171183
- repo: https://github.com/asottile/yesqa
172184
rev: v1.2.2
173185
hooks:
@@ -183,4 +195,14 @@ repos:
183195
hooks:
184196
- id: codespell
185197
types_or: [python, rst, markdown]
186-
files: ^pandas/core/
198+
files: ^pandas/
199+
exclude: ^pandas/tests/
200+
- repo: https://github.com/MarcoGorelli/no-string-hints
201+
rev: v0.1.7
202+
hooks:
203+
- id: no-string-hints
204+
- repo: https://github.com/MarcoGorelli/abs-imports
205+
rev: v0.1.2
206+
hooks:
207+
- id: abs-imports
208+
files: ^pandas/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<img src="https://dev.pandas.io/static/img/pandas.svg"><br>
2+
<img src="https://pandas.pydata.org/static/img/pandas.svg"><br>
33
</div>
44

55
-----------------

asv_bench/benchmarks/categoricals.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,29 @@ def setup(self):
118118
self.a = pd.Categorical(list("aabbcd") * N)
119119
self.b = pd.Categorical(list("bbcdjk") * N)
120120

121+
self.idx_a = pd.CategoricalIndex(range(N), range(N))
122+
self.idx_b = pd.CategoricalIndex(range(N + 1), range(N + 1))
123+
self.df_a = pd.DataFrame(range(N), columns=["a"], index=self.idx_a)
124+
self.df_b = pd.DataFrame(range(N + 1), columns=["a"], index=self.idx_b)
125+
121126
def time_concat(self):
122127
pd.concat([self.s, self.s])
123128

124129
def time_union(self):
125130
union_categoricals([self.a, self.b])
126131

132+
def time_append_overlapping_index(self):
133+
self.idx_a.append(self.idx_a)
134+
135+
def time_append_non_overlapping_index(self):
136+
self.idx_a.append(self.idx_b)
137+
138+
def time_concat_overlapping_index(self):
139+
pd.concat([self.df_a, self.df_a])
140+
141+
def time_concat_non_overlapping_index(self):
142+
pd.concat([self.df_a, self.df_b])
143+
127144

128145
class ValueCounts:
129146

@@ -306,7 +323,7 @@ def time_get_loc(self):
306323
self.index.get_loc(self.category)
307324

308325
def time_shallow_copy(self):
309-
self.index._shallow_copy()
326+
self.index._view()
310327

311328
def time_align(self):
312329
pd.DataFrame({"a": self.series, "b": self.series[:500]})

asv_bench/benchmarks/dtypes.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import numpy as np
44

5+
import pandas as pd
56
from pandas import DataFrame
67
import pandas._testing as tm
7-
from pandas.api.types import pandas_dtype
8+
from pandas.api.types import is_extension_array_dtype, pandas_dtype
89

910
from .pandas_vb_common import (
1011
datetime_dtypes,
@@ -119,4 +120,16 @@ def time_select_dtype_string_exclude(self, dtype):
119120
self.df_string.select_dtypes(exclude=dtype)
120121

121122

123+
class CheckDtypes:
124+
def setup(self):
125+
self.ext_dtype = pd.Int64Dtype()
126+
self.np_dtype = np.dtype("int64")
127+
128+
def time_is_extension_array_dtype_true(self):
129+
is_extension_array_dtype(self.ext_dtype)
130+
131+
def time_is_extension_array_dtype_false(self):
132+
is_extension_array_dtype(self.np_dtype)
133+
134+
122135
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/gil.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, Series, date_range, factorize, read_csv
4-
from pandas.core.algorithms import take_1d
4+
from pandas.core.algorithms import take_nd
55

66
from .pandas_vb_common import tm
77

@@ -110,7 +110,7 @@ def setup(self, dtype):
110110

111111
@test_parallel(num_threads=2)
112112
def parallel_take1d():
113-
take_1d(df["col"].values, indexer)
113+
take_nd(df["col"].values, indexer)
114114

115115
self.parallel_take1d = parallel_take1d
116116

0 commit comments

Comments
 (0)