Skip to content

Commit 07af101

Browse files
Merge remote-tracking branch 'upstream/main' into 2022-06-29-FIX-46671
2 parents b2ae03d + 30efa5f commit 07af101

File tree

488 files changed

+10773
-5131
lines changed

Some content is hidden

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

488 files changed

+10773
-5131
lines changed

.github/workflows/32-bit-linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ jobs:
3939
. ~/virtualenvs/pandas-dev/bin/activate && \
4040
python -m pip install --no-deps -U pip wheel 'setuptools<60.0.0' && \
4141
pip install cython numpy python-dateutil pytz pytest pytest-xdist pytest-asyncio>=0.17 hypothesis && \
42-
python setup.py build_ext -q -j2 && \
42+
python setup.py build_ext -q -j1 && \
4343
python -m pip install --no-build-isolation --no-use-pep517 -e . && \
44+
python -m pip list && \
4445
export PANDAS_CI=1 && \
4546
pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml"
4647

.github/workflows/codeql.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CodeQL
2+
on:
3+
schedule:
4+
# every day at midnight
5+
- cron: "0 0 * * *"
6+
7+
concurrency:
8+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
analyze:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
actions: read
16+
contents: read
17+
security-events: write
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language:
23+
- python
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: github/codeql-action/init@v2
28+
with:
29+
languages: ${{ matrix.language }}
30+
- uses: github/codeql-action/autobuild@v2
31+
- uses: github/codeql-action/analyze@v2

.github/workflows/python-dev.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
# This file is purposely frozen(does not run). DO NOT DELETE IT
2-
# Unfreeze(by commentingthe if: false() condition) once the
3-
# next Python Dev version has released beta 1 and both Cython and numpy support it
4-
# After that Python has released, migrate the workflows to the
5-
# posix GHA workflows and "freeze" this file by
6-
# uncommenting the if: false() condition
1+
# This workflow may or may not run depending on the state of the next
2+
# unreleased Python version. DO NOT DELETE IT.
3+
#
4+
# In general, this file will remain frozen(present, but not running) until:
5+
# - The next unreleased Python version has released beta 1
6+
# - This version should be available on Github Actions.
7+
# - Our required build/runtime dependencies(numpy, pytz, Cython, python-dateutil)
8+
# support that unreleased Python version.
9+
# To unfreeze, comment out the ``if: false`` condition, and make sure you update
10+
# the name of the workflow and Python version in actions/setup-python to: '3.12-dev'
11+
#
12+
# After it has been unfrozen, this file should remain unfrozen(present, and running) until:
13+
# - The next Python version has been officially released.
14+
# OR
15+
# - Most/All of our optional dependencies support Python 3.11 AND
16+
# - The next Python version has released a rc(we are guaranteed a stable ABI).
17+
# To freeze this file, uncomment out the ``if: false`` condition, and migrate the jobs
18+
# to the corresponding posix/windows-macos/sdist etc. workflows.
719
# Feel free to modify this comment as necessary.
820

921
name: Python Dev
@@ -32,7 +44,7 @@ permissions:
3244

3345
jobs:
3446
build:
35-
if: false # Comment this line out to "unfreeze"
47+
# if: false # Uncomment this to freeze the workflow, comment it to unfreeze
3648
runs-on: ${{ matrix.os }}
3749
strategy:
3850
fail-fast: false
@@ -53,27 +65,27 @@ jobs:
5365
fetch-depth: 0
5466

5567
- name: Set up Python Dev Version
56-
uses: actions/setup-python@v3
68+
uses: actions/setup-python@v4
5769
with:
5870
python-version: '3.11-dev'
5971

6072
- name: Install dependencies
61-
shell: bash -el {0}
6273
run: |
63-
python3 -m pip install --upgrade pip setuptools wheel
64-
python3 -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
65-
python3 -m pip install git+https://github.com/nedbat/coveragepy.git
66-
python3 -m pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
67-
python3 -m pip list
74+
python --version
75+
python -m pip install --upgrade pip setuptools wheel
76+
python -m pip install git+https://github.com/numpy/numpy.git
77+
python -m pip install git+https://github.com/nedbat/coveragepy.git
78+
python -m pip install python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
79+
python -m pip list
6880
6981
- name: Build Pandas
7082
run: |
71-
python3 setup.py build_ext -q -j2
72-
python3 -m pip install -e . --no-build-isolation --no-use-pep517
83+
python setup.py build_ext -q -j2
84+
python -m pip install -e . --no-build-isolation --no-use-pep517
7385
7486
- name: Build Version
7587
run: |
76-
python3 -c "import pandas; pandas.show_versions();"
88+
python -c "import pandas; pandas.show_versions();"
7789
7890
- name: Test
7991
uses: ./.github/actions/run-tests

.github/workflows/sdist.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ jobs:
7979
run: |
8080
case "${{matrix.python-version}}" in
8181
3.8)
82-
pip install numpy==1.19.5 ;;
82+
pip install numpy==1.20.3 ;;
8383
3.9)
84-
pip install numpy==1.19.5 ;;
84+
pip install numpy==1.20.3 ;;
8585
3.10)
8686
pip install numpy==1.21.2 ;;
8787
esac

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
env_file: actions-310-numpydev.yaml
6565
pattern: "not slow and not network and not single_cpu"
6666
pandas_testing_mode: "deprecate"
67-
test_args: "-W error::DeprecationWarning:numpy"
67+
test_args: "-W error::DeprecationWarning:numpy -W error::FutureWarning:numpy"
6868
exclude:
6969
- env_file: actions-39.yaml
7070
pyarrow_version: "6"

.pre-commit-config.yaml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- id: absolufy-imports
1212
files: ^pandas/
1313
- repo: https://github.com/jendrikseipp/vulture
14-
rev: 'v2.4'
14+
rev: 'v2.5'
1515
hooks:
1616
- id: vulture
1717
entry: python scripts/run_vulture.py
@@ -46,20 +46,19 @@ repos:
4646
exclude: ^pandas/_libs/src/(klib|headers)/
4747
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
4848
- repo: https://github.com/PyCQA/flake8
49-
rev: 4.0.1
49+
rev: 5.0.4
5050
hooks:
5151
- id: flake8
5252
additional_dependencies: &flake8_dependencies
53-
- flake8==4.0.1
54-
- flake8-comprehensions==3.7.0
55-
- flake8-bugbear==21.3.2
53+
- flake8==5.0.4
54+
- flake8-bugbear==22.7.1
5655
- pandas-dev-flaker==0.5.0
5756
- repo: https://github.com/PyCQA/isort
5857
rev: 5.10.1
5958
hooks:
6059
- id: isort
6160
- repo: https://github.com/asottile/pyupgrade
62-
rev: v2.34.0
61+
rev: v2.37.3
6362
hooks:
6463
- id: pyupgrade
6564
args: [--py38-plus]
@@ -85,38 +84,42 @@ repos:
8584
- repo: local
8685
hooks:
8786
- id: pyright
87+
# note: assumes python env is setup and activated
8888
name: pyright
8989
entry: pyright
90-
# note: assumes python env is setup and activated
9190
language: node
9291
pass_filenames: false
9392
types: [python]
9493
stages: [manual]
9594
additional_dependencies: &pyright_dependencies
96-
- pyright@1.1.258
97-
- repo: local
98-
hooks:
95+
- pyright@1.1.264
9996
- id: pyright_reportGeneralTypeIssues
97+
# note: assumes python env is setup and activated
10098
name: pyright reportGeneralTypeIssues
10199
entry: pyright --skipunannotated -p pyright_reportGeneralTypeIssues.json
102-
# note: assumes python env is setup and activated
103100
language: node
104101
pass_filenames: false
105102
types: [python]
106103
stages: [manual]
107104
additional_dependencies: *pyright_dependencies
108-
- repo: local
109-
hooks:
110105
- id: mypy
106+
# note: assumes python env is setup and activated
111107
name: mypy
112108
entry: mypy
113-
# note: assumes python env is setup and activated
114109
language: system
115110
pass_filenames: false
116111
types: [python]
117112
stages: [manual]
118-
- repo: local
119-
hooks:
113+
- id: stubtest
114+
# note: assumes python env is setup and activated
115+
# note: requires pandas dev to be installed
116+
name: mypy (stubtest)
117+
entry: python
118+
language: system
119+
pass_filenames: false
120+
types: [pyi]
121+
args: [scripts/run_stubtest.py]
122+
stages: [manual]
120123
- id: flake8-rst
121124
name: flake8-rst
122125
description: Run flake8 on code snippets in docstrings or RST files
@@ -235,5 +238,17 @@ repos:
235238
types: [pyi]
236239
language: python
237240
additional_dependencies:
238-
- flake8==4.0.1
239-
- flake8-pyi==22.5.1
241+
- flake8==5.0.4
242+
- flake8-pyi==22.8.1
243+
- id: future-annotations
244+
name: import annotations from __future__
245+
entry: 'from __future__ import annotations'
246+
language: pygrep
247+
args: [--negate]
248+
files: ^pandas/
249+
types: [python]
250+
exclude: |
251+
(?x)
252+
/(__init__\.py)|(api\.py)|(_version\.py)|(testing\.py)|(conftest\.py)$
253+
|/tests/
254+
|/_testing/

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM quay.io/condaforge/miniforge3
1+
FROM quay.io/condaforge/mambaforge
22

33
# if you forked pandas, you can pass in your own GitHub username to use your fork
44
# i.e. gh_username=myname
@@ -40,7 +40,6 @@ RUN mkdir "$pandas_home" \
4040
# we just update the base/root one from the 'environment.yml' file instead of creating a new one.
4141
#
4242
# Set up environment
43-
RUN conda install -y mamba
4443
RUN mamba env update -n base -f "$pandas_home/environment.yml"
4544

4645
# Build C extensions and pandas

asv_bench/asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// followed by the pip installed packages).
4343
"matrix": {
4444
"numpy": [],
45-
"Cython": ["0.29.30"],
45+
"Cython": ["0.29.32"],
4646
"matplotlib": [],
4747
"sqlalchemy": [],
4848
"scipy": [],

asv_bench/benchmarks/hash_functions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ def time_unique(self, exponent):
3939
pd.unique(self.a2)
4040

4141

42+
class Unique:
43+
params = ["Int64", "Float64"]
44+
param_names = ["dtype"]
45+
46+
def setup(self, dtype):
47+
self.ser = pd.Series(([1, pd.NA, 2] + list(range(100_000))) * 3, dtype=dtype)
48+
self.ser_unique = pd.Series(list(range(300_000)) + [pd.NA], dtype=dtype)
49+
50+
def time_unique_with_duplicates(self, exponent):
51+
pd.unique(self.ser)
52+
53+
def time_unique(self, exponent):
54+
pd.unique(self.ser_unique)
55+
56+
4257
class NumericSeriesIndexing:
4358

4459
params = [

asv_bench/benchmarks/reshape.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ def setup(self, bins):
268268
self.datetime_series = pd.Series(
269269
np.random.randint(N, size=N), dtype="datetime64[ns]"
270270
)
271-
self.interval_bins = pd.IntervalIndex.from_breaks(
272-
np.linspace(0, N, bins), "right"
273-
)
271+
self.interval_bins = pd.IntervalIndex.from_breaks(np.linspace(0, N, bins))
274272

275273
def time_cut_int(self, bins):
276274
pd.cut(self.int_series, bins)

asv_bench/benchmarks/series_methods.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ def time_clip(self, n):
144144
self.s.clip(0, 1)
145145

146146

147+
class ClipDt:
148+
def setup(self):
149+
dr = date_range("20220101", periods=100_000, freq="s", tz="UTC")
150+
self.clipper_dt = dr[0:1_000].repeat(100)
151+
self.s = Series(dr)
152+
153+
def time_clip(self):
154+
self.s.clip(upper=self.clipper_dt)
155+
156+
147157
class ValueCounts:
148158

149159
params = [[10**3, 10**4, 10**5], ["int", "uint", "float", "object"]]

ci/code_checks.sh

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

81-
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05)' ; echo $MSG
82-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05
81+
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG
82+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05,SS06
8383
RET=$(($RET + $?)) ; echo $MSG "DONE"
8484

8585
fi

ci/deps/actions-310-numpydev.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ dependencies:
1616
- pytz
1717
- pip
1818
- pip:
19-
#- cython # TODO: don't install from master after Cython 3.0.0a11 is released
20-
- "git+https://github.com/cython/cython.git@master"
19+
- "cython"
2120
- "--extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple"
2221
- "--pre"
2322
- "numpy"

ci/deps/actions-310.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.10
66

77
# test dependencies
8-
- cython=0.29.30
8+
- cython>=0.29.32
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
@@ -47,6 +47,7 @@ dependencies:
4747
- scipy
4848
- sqlalchemy
4949
- tabulate
50+
- tzdata>=2022a
5051
- xarray
5152
- xlrd
5253
- xlsxwriter

ci/deps/actions-38-downstream_compat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.8
77

88
# test dependencies
9-
- cython=0.29.30
9+
- cython>=0.29.32
1010
- pytest>=6.0
1111
- pytest-cov
1212
- pytest-xdist>=1.31

ci/deps/actions-38-minimum_versions.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- python=3.8.0
88

99
# test dependencies
10-
- cython=0.29.30
10+
- cython>=0.29.32
1111
- pytest>=6.0
1212
- pytest-cov
1313
- pytest-xdist>=1.31
@@ -17,7 +17,7 @@ dependencies:
1717

1818
# required dependencies
1919
- python-dateutil=2.8.1
20-
- numpy=1.19.5
20+
- numpy=1.20.3
2121
- pytz=2020.1
2222

2323
# optional dependencies
@@ -49,6 +49,7 @@ dependencies:
4949
- scipy=1.7.1
5050
- sqlalchemy=1.4.16
5151
- tabulate=0.8.9
52+
- tzdata=2022a
5253
- xarray=0.19.0
5354
- xlrd=2.0.1
5455
- xlsxwriter=1.4.3

0 commit comments

Comments
 (0)