Skip to content

Commit eb7d8f2

Browse files
authored
Merge branch 'master' into stringarray-nan
2 parents 5e5aa9c + 47eb219 commit eb7d8f2

File tree

404 files changed

+8015
-5517
lines changed

Some content is hidden

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

404 files changed

+8015
-5517
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ body:
77
- type: checkboxes
88
id: checks
99
attributes:
10+
label: Pandas version checks
1011
options:
1112
- label: >
1213
I have checked that this issue has not already been reported.

.github/ISSUE_TEMPLATE/documentation_improvement.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ labels: [Docs, Needs Triage]
66
body:
77
- type: checkboxes
88
attributes:
9+
label: Pandas version checks
910
options:
1011
- label: >
1112
I have checked that the issue still exists on the latest versions of the docs

.github/ISSUE_TEMPLATE/installation_issue.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ body:
77
- type: checkboxes
88
id: checks
99
attributes:
10+
label: Installation check
1011
options:
1112
- label: >
1213
I have read the [installation guide](https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html#installing-pandas).

.github/ISSUE_TEMPLATE/performance_issue.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ body:
77
- type: checkboxes
88
id: checks
99
attributes:
10+
label: Pandas version checks
1011
options:
1112
- label: >
1213
I have checked that this issue has not already been reported.

.github/ISSUE_TEMPLATE/submit_question.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ body:
1111
usage questions, we ask that all usage questions are first asked on StackOverflow.
1212
- type: checkboxes
1313
attributes:
14+
label: Research
1415
options:
1516
- label: >
1617
I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas)

.github/workflows/ci.yml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ jobs:
2323
shell: bash -l {0}
2424

2525
concurrency:
26-
group: ${{ github.ref }}-checks
27-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
26+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
27+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-checks
28+
cancel-in-progress: true
2829

2930
steps:
3031
- name: Checkout
@@ -77,6 +78,40 @@ jobs:
7778
run: pytest scripts
7879
if: always()
7980

81+
benchmarks:
82+
name: Benchmarks
83+
runs-on: ubuntu-latest
84+
defaults:
85+
run:
86+
shell: bash -l {0}
87+
88+
concurrency:
89+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
90+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-benchmarks
91+
cancel-in-progress: true
92+
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v2
96+
with:
97+
fetch-depth: 0
98+
99+
- name: Cache conda
100+
uses: actions/cache@v2
101+
with:
102+
path: ~/conda_pkgs_dir
103+
key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }}
104+
105+
- uses: conda-incubator/setup-miniconda@v2
106+
with:
107+
activate-environment: pandas-dev
108+
channel-priority: strict
109+
environment-file: ${{ env.ENV_FILE }}
110+
use-only-tar-bz2: true
111+
112+
- name: Build Pandas
113+
uses: ./.github/actions/build_pandas
114+
80115
- name: Running benchmarks
81116
run: |
82117
cd asv_bench
@@ -102,7 +137,8 @@ jobs:
102137
runs-on: ubuntu-latest
103138

104139
concurrency:
105-
group: ${{ github.ref }}-web-docs
140+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
141+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-web-docs
106142
cancel-in-progress: true
107143

108144
steps:
@@ -160,11 +196,20 @@ jobs:
160196
data_manager:
161197
name: Test experimental data manager
162198
runs-on: ubuntu-latest
199+
services:
200+
moto:
201+
image: motoserver/moto
202+
env:
203+
AWS_ACCESS_KEY_ID: foobar_key
204+
AWS_SECRET_ACCESS_KEY: foobar_secret
205+
ports:
206+
- 5000:5000
163207
strategy:
164208
matrix:
165209
pattern: ["not slow and not network and not clipboard", "slow"]
166210
concurrency:
167-
group: ${{ github.ref }}-data_manager-${{ matrix.pattern }}
211+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
212+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-data_manager-${{ matrix.pattern }}
168213
cancel-in-progress: true
169214

170215
steps:

.github/workflows/database.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ jobs:
3131
fail-fast: false
3232

3333
concurrency:
34-
group: ${{ github.ref }}-${{ matrix.ENV_FILE }}
35-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
34+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
35+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.ENV_FILE }}
36+
cancel-in-progress: true
3637

3738
services:
3839
mysql:
@@ -62,6 +63,14 @@ jobs:
6263
ports:
6364
- 5432:5432
6465

66+
moto:
67+
image: motoserver/moto
68+
env:
69+
AWS_ACCESS_KEY_ID: foobar_key
70+
AWS_SECRET_ACCESS_KEY: foobar_secret
71+
ports:
72+
- 5000:5000
73+
6574
steps:
6675
- name: Checkout
6776
uses: actions/checkout@v2

.github/workflows/posix.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ jobs:
2727
settings: [
2828
[actions-38-minimum_versions.yaml, "not slow and not network and not clipboard", "", "", "", "", ""],
2929
[actions-38-locale_slow.yaml, "slow", "language-pack-it xsel", "it_IT.utf8", "it_IT.utf8", "", ""],
30-
[actions-38.yaml, "not slow and not network and not clipboard", "", "", "", "", ""],
30+
[actions-38.yaml, "not slow and not clipboard", "", "", "", "", ""],
3131
[actions-38-slow.yaml, "slow", "", "", "", "", ""],
3232
[actions-38-locale.yaml, "not slow and not network", "language-pack-zh-hans xsel", "zh_CN.utf8", "zh_CN.utf8", "", ""],
3333
[actions-39-slow.yaml, "slow", "", "", "", "", ""],
34+
[actions-pypy-38.yaml, "not slow and not clipboard", "", "", "", "", "--max-worker-restart 0"],
3435
[actions-39-numpydev.yaml, "not slow and not network", "xsel", "", "", "deprecate", "-W error"],
35-
[actions-39.yaml, "not slow and not network and not clipboard", "", "", "", "", ""]
36+
[actions-39.yaml, "not slow and not clipboard", "", "", "", "", ""]
3637
]
3738
fail-fast: false
3839
env:
39-
COVERAGE: true
4040
ENV_FILE: ci/deps/${{ matrix.settings[0] }}
4141
PATTERN: ${{ matrix.settings[1] }}
4242
EXTRA_APT: ${{ matrix.settings[2] }}
@@ -45,9 +45,21 @@ jobs:
4545
PANDAS_TESTING_MODE: ${{ matrix.settings[5] }}
4646
TEST_ARGS: ${{ matrix.settings[6] }}
4747
PYTEST_TARGET: pandas
48+
IS_PYPY: ${{ contains(matrix.settings[0], 'pypy') }}
49+
# TODO: re-enable coverage on pypy, its slow
50+
COVERAGE: ${{ !contains(matrix.settings[0], 'pypy') }}
4851
concurrency:
49-
group: ${{ github.ref }}-${{ matrix.settings[0] }}
50-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
52+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
53+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.settings[0] }}
54+
cancel-in-progress: true
55+
services:
56+
moto:
57+
image: motoserver/moto
58+
env:
59+
AWS_ACCESS_KEY_ID: foobar_key
60+
AWS_SECRET_ACCESS_KEY: foobar_secret
61+
ports:
62+
- 5000:5000
5163

5264
steps:
5365
- name: Checkout
@@ -73,12 +85,29 @@ jobs:
7385
channel-priority: flexible
7486
environment-file: ${{ env.ENV_FILE }}
7587
use-only-tar-bz2: true
88+
if: ${{ env.IS_PYPY == 'false' }} # No pypy3.8 support
89+
90+
- name: Setup PyPy
91+
uses: actions/[email protected]
92+
with:
93+
python-version: "pypy-3.8"
94+
if: ${{ env.IS_PYPY == 'true' }}
95+
96+
- name: Setup PyPy dependencies
97+
shell: bash
98+
run: |
99+
# TODO: re-enable cov, its slowing the tests down though
100+
# TODO: Unpin Cython, the new Cython 0.29.26 is causing compilation errors
101+
pip install Cython==0.29.25 numpy python-dateutil pytz pytest>=6.0 pytest-xdist>=1.31.0 hypothesis>=5.5.3
102+
if: ${{ env.IS_PYPY == 'true' }}
76103

77104
- name: Build Pandas
78105
uses: ./.github/actions/build_pandas
79106

80107
- name: Test
81108
run: ci/run_tests.sh
109+
# TODO: Don't continue on error for PyPy
110+
continue-on-error: ${{ env.IS_PYPY == 'true' }}
82111
if: always()
83112

84113
- name: Build Version

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ jobs:
1111
pre-commit:
1212
runs-on: ubuntu-latest
1313
concurrency:
14-
group: ${{ github.ref }}-pre-commit
15-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
14+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
15+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-pre-commit
16+
cancel-in-progress: true
1617
steps:
1718
- uses: actions/checkout@v2
1819
- uses: actions/setup-python@v2

.github/workflows/python-dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ jobs:
3131
timeout-minutes: 80
3232

3333
concurrency:
34-
group: ${{ github.ref }}-${{ matrix.os }}-${{ matrix.pytest_target }}-dev
35-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
34+
#https://github.community/t/concurrecy-not-work-for-push/183068/7
35+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-${{ matrix.pytest_target }}-dev
36+
cancel-in-progress: true
3637

3738
steps:
3839
- uses: actions/checkout@v2

.github/workflows/sdist.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ jobs:
2525
matrix:
2626
python-version: ["3.8", "3.9", "3.10"]
2727
concurrency:
28-
group: ${{github.ref}}-${{matrix.python-version}}-sdist
29-
cancel-in-progress: ${{github.event_name == 'pull_request'}}
28+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
29+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{matrix.python-version}}-sdist
30+
cancel-in-progress: true
3031

3132
steps:
3233
- uses: actions/checkout@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ dist
5050
*.egg-info
5151
.eggs
5252
.pypirc
53+
# type checkers
54+
pandas/py.typed
5355

5456
# tox testing tool
5557
.tox

.pre-commit-config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: absolufy-imports
1010
files: ^pandas/
1111
- repo: https://github.com/python/black
12-
rev: 21.10b0
12+
rev: 21.11b1
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/codespell-project/codespell
@@ -55,11 +55,11 @@ repos:
5555
types: [text]
5656
args: [--append-config=flake8/cython-template.cfg]
5757
- repo: https://github.com/PyCQA/isort
58-
rev: 5.9.3
58+
rev: 5.10.1
5959
hooks:
6060
- id: isort
6161
- repo: https://github.com/asottile/pyupgrade
62-
rev: v2.29.0
62+
rev: v2.29.1
6363
hooks:
6464
- id: pyupgrade
6565
args: [--py38-plus]
@@ -111,6 +111,8 @@ repos:
111111
# Incorrect code-block / IPython directives
112112
|\.\.\ code-block\ ::
113113
|\.\.\ ipython\ ::
114+
# directive should not have a space before ::
115+
|\.\.\ \w+\ ::
114116
115117
# Check for deprecated messages without sphinx directive
116118
|(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)

asv_bench/benchmarks/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def setup(self, op, shape):
144144
# should already be the case, but just to be sure
145145
df._consolidate_inplace()
146146

147-
# TODO: GH#33198 the setting here shoudlnt need two steps
147+
# TODO: GH#33198 the setting here shouldn't need two steps
148148
arr1 = np.random.randn(n_rows, max(n_cols // 4, 3)).astype("f8")
149149
arr2 = np.random.randn(n_rows, n_cols // 2).astype("i8")
150150
arr3 = np.random.randn(n_rows, n_cols // 4).astype("f8")

asv_bench/benchmarks/frame_ctor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
)
2020
except ImportError:
2121
# For compatibility with older versions
22-
from pandas.core.datetools import * # noqa
22+
from pandas.core.datetools import (
23+
Hour,
24+
Nano,
25+
)
2326

2427

2528
class FromDicts:

asv_bench/benchmarks/frame_methods.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def time_reindex_axis1_missing(self):
7676
self.df.reindex(columns=self.idx)
7777

7878
def time_reindex_both_axes(self):
79-
self.df.reindex(index=self.idx, columns=self.idx)
79+
self.df.reindex(index=self.idx, columns=self.idx_cols)
8080

8181
def time_reindex_upcast(self):
8282
self.df2.reindex(np.random.permutation(range(1200)))
@@ -731,17 +731,6 @@ def time_dataframe_describe(self):
731731
self.df.describe()
732732

733733

734-
class SelectDtypes:
735-
params = [100, 1000]
736-
param_names = ["n"]
737-
738-
def setup(self, n):
739-
self.df = DataFrame(np.random.randn(10, n))
740-
741-
def time_select_dtypes(self, n):
742-
self.df.select_dtypes(include="int")
743-
744-
745734
class MemoryUsage:
746735
def setup(self):
747736
self.df = DataFrame(np.random.randn(100000, 2), columns=list("AB"))

asv_bench/benchmarks/io/csv.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ def time_frame(self, kind):
5555
self.df.to_csv(self.fname)
5656

5757

58+
class ToCSVMultiIndexUnusedLevels(BaseIO):
59+
60+
fname = "__test__.csv"
61+
62+
def setup(self):
63+
df = DataFrame({"a": np.random.randn(100_000), "b": 1, "c": 1})
64+
self.df = df.set_index(["a", "b"])
65+
self.df_unused_levels = self.df.iloc[:10_000]
66+
self.df_single_index = df.set_index(["a"]).iloc[:10_000]
67+
68+
def time_full_frame(self):
69+
self.df.to_csv(self.fname)
70+
71+
def time_sliced_frame(self):
72+
self.df_unused_levels.to_csv(self.fname)
73+
74+
def time_single_index_frame(self):
75+
self.df_single_index.to_csv(self.fname)
76+
77+
5878
class ToCSVDatetime(BaseIO):
5979

6080
fname = "__test__.csv"
@@ -67,6 +87,21 @@ def time_frame_date_formatting(self):
6787
self.data.to_csv(self.fname, date_format="%Y%m%d")
6888

6989

90+
class ToCSVDatetimeIndex(BaseIO):
91+
92+
fname = "__test__.csv"
93+
94+
def setup(self):
95+
rng = date_range("2000", periods=100_000, freq="S")
96+
self.data = DataFrame({"a": 1}, index=rng)
97+
98+
def time_frame_date_formatting_index(self):
99+
self.data.to_csv(self.fname, date_format="%Y-%m-%d %H:%M:%S")
100+
101+
def time_frame_date_no_format_index(self):
102+
self.data.to_csv(self.fname)
103+
104+
70105
class ToCSVDatetimeBig(BaseIO):
71106

72107
fname = "__test__.csv"

0 commit comments

Comments
 (0)