Skip to content

Commit c70f68b

Browse files
authored
Merge branch 'main' into tguard
2 parents 3e5b5c5 + 83858b2 commit c70f68b

File tree

330 files changed

+6170
-3350
lines changed

Some content is hidden

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

330 files changed

+6170
-3350
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deprecations Bot
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
[closed]
9+
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
deprecation_update:
16+
permissions:
17+
issues: write
18+
if: >-
19+
contains(github.event.pull_request.labels.*.name, 'Deprecate') && github.event.pull_request.merged == true
20+
runs-on: ubuntu-22.04
21+
env:
22+
DEPRECATION_TRACKER_ISSUE: 50578
23+
steps:
24+
- name: Checkout
25+
run: |
26+
echo "Adding deprecation PR number to deprecation tracking issue"
27+
export PR=${{ github.event.pull_request.number }}
28+
BODY=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/issues/${DEPRECATION_TRACKER_ISSUE} |
29+
python3 -c "import sys, json, os; x = {'body': json.load(sys.stdin)['body']}; pr = os.environ['PR']; x['body'] += f'\n- [ ] #{pr}'; print(json.dumps(x))")
30+
echo ${BODY}
31+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X PATCH -d "${BODY}" https://api.github.com/repos/${{ github.repository }}/issues/${DEPRECATION_TRACKER_ISSUE}

.github/workflows/docbuild-and-upload.yml

+7
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,10 @@ jobs:
8989
name: website
9090
path: web/build
9191
retention-days: 14
92+
93+
- name: Trigger web/doc preview
94+
run: curl -X POST https://pandas.pydata.org/preview/submit/$RUN_ID/$PR_ID/
95+
env:
96+
RUN_ID: ${{ github.run_id }}
97+
PR_ID: ${{ github.event.pull_request.number }}
98+
if: github.event_name == 'pull_request'

.github/workflows/preview-docs.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Preview docs
2+
on:
3+
issue_comment:
4+
types: created
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
preview_docs:
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- if: github.event.comment.body == '/preview'
17+
run: |
18+
if curl --output /dev/null --silent --head --fail "https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"; then
19+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "Website preview of this PR available at: https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments
20+
else
21+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "No preview found for PR #${{ github.event.issue.number }}. Did the docs build complete?"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments
22+
fi

.github/workflows/ubuntu.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ on:
1515
- "doc/**"
1616
- "web/**"
1717

18-
env:
19-
PANDAS_CI: 1
20-
2118
permissions:
2219
contents: read
2320

@@ -33,6 +30,7 @@ jobs:
3330
env_file: [actions-38.yaml, actions-39.yaml, actions-310.yaml, actions-311.yaml]
3431
pattern: ["not single_cpu", "single_cpu"]
3532
pyarrow_version: ["8", "9", "10"]
33+
pandas_ci: [1]
3634
include:
3735
- name: "Downstream Compat"
3836
env_file: actions-38-downstream_compat.yaml
@@ -77,6 +75,9 @@ jobs:
7775
env_file: actions-310-numpydev.yaml
7876
pattern: "not slow and not network and not single_cpu"
7977
test_args: "-W error::DeprecationWarning -W error::FutureWarning"
78+
# TODO(cython3): Re-enable once next-beta(after beta 1) comes out
79+
# There are some warnings failing the build with -werror
80+
pandas_ci: 0
8081
exclude:
8182
- env_file: actions-38.yaml
8283
pyarrow_version: "8"
@@ -100,6 +101,7 @@ jobs:
100101
LC_ALL: ${{ matrix.lc_all || '' }}
101102
PANDAS_DATA_MANAGER: ${{ matrix.pandas_data_manager || 'block' }}
102103
PANDAS_COPY_ON_WRITE: ${{ matrix.pandas_copy_on_write || '0' }}
104+
PANDAS_CI: ${{ matrix.pandas_ci }}
103105
TEST_ARGS: ${{ matrix.test_args || '' }}
104106
PYTEST_WORKERS: ${{ contains(matrix.pattern, 'not single_cpu') && 'auto' || '1' }}
105107
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}
@@ -140,7 +142,7 @@ jobs:
140142
- 5432:5432
141143

142144
moto:
143-
image: motoserver/moto
145+
image: motoserver/moto:4.1.4
144146
env:
145147
AWS_ACCESS_KEY_ID: foobar_key
146148
AWS_SECRET_ACCESS_KEY: foobar_secret

.pep8speaks.yml

-4
This file was deleted.

.pre-commit-config.yaml

+12-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
types_or: [python, pyi]
2929
additional_dependencies: [black==23.1.0]
3030
- repo: https://github.com/charliermarsh/ruff-pre-commit
31-
rev: v0.0.244
31+
rev: v0.0.253
3232
hooks:
3333
- id: ruff
3434
- repo: https://github.com/jendrikseipp/vulture
@@ -42,10 +42,10 @@ repos:
4242
rev: v2.2.2
4343
hooks:
4444
- id: codespell
45-
types_or: [python, rst, markdown]
45+
types_or: [python, rst, markdown, cython, c]
4646
additional_dependencies: [tomli]
4747
- repo: https://github.com/MarcoGorelli/cython-lint
48-
rev: v0.12.4
48+
rev: v0.12.5
4949
hooks:
5050
- id: cython-lint
5151
- id: double-quote-cython-strings
@@ -78,12 +78,12 @@ repos:
7878
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
7979
]
8080
- repo: https://github.com/pycqa/pylint
81-
rev: v2.16.1
81+
rev: v2.16.2
8282
hooks:
8383
- id: pylint
8484
stages: [manual]
8585
- repo: https://github.com/pycqa/pylint
86-
rev: v2.16.1
86+
rev: v2.16.2
8787
hooks:
8888
- id: pylint
8989
alias: redefined-outer-name
@@ -160,14 +160,6 @@ repos:
160160
types: [pyi]
161161
args: [scripts/run_stubtest.py]
162162
stages: [manual]
163-
- id: flake8-rst
164-
name: flake8-rst
165-
description: Run flake8 on code snippets in docstrings or RST files
166-
language: python
167-
entry: flake8-rst
168-
types: [rst]
169-
args: [--filename=*.rst]
170-
additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9]
171163
- id: inconsistent-namespace-usage
172164
name: 'Check for inconsistent use of pandas namespace'
173165
entry: python scripts/check_for_inconsistent_pandas_namespace.py
@@ -342,11 +334,6 @@ repos:
342334
(?x)
343335
^(asv_bench|pandas/tests|doc)/
344336
|scripts/validate_min_versions_in_sync\.py$
345-
- id: unwanted-patterns-strings-to-concatenate
346-
name: Check for use of not concatenated strings
347-
language: python
348-
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
349-
types_or: [python, cython]
350337
- id: unwanted-patterns-strings-with-misplaced-whitespace
351338
name: Check for strings with misplaced spaces
352339
language: python
@@ -441,3 +428,10 @@ repos:
441428
types: [python]
442429
files: ^pandas/tests
443430
language: python
431+
- id: sort-whatsnew-items
432+
name: sort whatsnew entries by issue number
433+
entry: python -m scripts.sort_whatsnew_note
434+
types: [rst]
435+
language: python
436+
files: ^doc/source/whatsnew/v
437+
exclude: ^doc/source/whatsnew/v(0|1|2\.0\.0)

asv_bench/asv.conf.json

+1-1
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.32"],
45+
"Cython": ["0.29.33"],
4646
"matplotlib": [],
4747
"sqlalchemy": [],
4848
"scipy": [],

asv_bench/benchmarks/frame_methods.py

+18
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,24 @@ def time_memory_usage_object_dtype(self):
770770
self.df2.memory_usage(deep=True)
771771

772772

773+
class Round:
774+
def setup(self):
775+
self.df = DataFrame(np.random.randn(10000, 10))
776+
self.df_t = self.df.transpose(copy=True)
777+
778+
def time_round(self):
779+
self.df.round()
780+
781+
def time_round_transposed(self):
782+
self.df_t.round()
783+
784+
def peakmem_round(self):
785+
self.df.round()
786+
787+
def peakmem_round_transposed(self):
788+
self.df_t.round()
789+
790+
773791
class Where:
774792
params = (
775793
[True, False],

asv_bench/benchmarks/io/csv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def setup(self, sep, decimal, float_precision):
318318
"".join([random.choice(string.digits) for _ in range(28)])
319319
for _ in range(15)
320320
]
321-
rows = sep.join([f"0{decimal}" + "{}"] * 3) + "\n"
321+
rows = sep.join([f"0{decimal}{{}}"] * 3) + "\n"
322322
data = rows * 5
323323
data = data.format(*floats) * 200 # 1000 x 3 strings csv
324324
self.StringIO_input = StringIO(data)

asv_bench/benchmarks/series_methods.py

+29
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,33 @@ def time_to_numpy_copy(self):
386386
self.ser.to_numpy(copy=True)
387387

388388

389+
class Replace:
390+
param_names = ["num_to_replace"]
391+
params = [100, 1000]
392+
393+
def setup(self, num_to_replace):
394+
N = 1_000_000
395+
self.arr = np.random.randn(N)
396+
self.arr1 = self.arr.copy()
397+
np.random.shuffle(self.arr1)
398+
self.ser = Series(self.arr)
399+
400+
self.to_replace_list = np.random.choice(self.arr, num_to_replace)
401+
self.values_list = np.random.choice(self.arr1, num_to_replace)
402+
403+
self.replace_dict = dict(zip(self.to_replace_list, self.values_list))
404+
405+
def time_replace_dict(self, num_to_replace):
406+
self.ser.replace(self.replace_dict)
407+
408+
def peakmem_replace_dict(self, num_to_replace):
409+
self.ser.replace(self.replace_dict)
410+
411+
def time_replace_list(self, num_to_replace):
412+
self.ser.replace(self.to_replace_list, self.values_list)
413+
414+
def peakmem_replace_list(self, num_to_replace):
415+
self.ser.replace(self.to_replace_list, self.values_list)
416+
417+
389418
from .pandas_vb_common import setup # noqa: F401 isort:skip

ci/code_checks.sh

+3-21
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ fi
7979
### DOCSTRINGS ###
8080
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8181

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

8686
MSG='Partially validate docstrings (EX01)' ; echo $MSG
@@ -93,8 +93,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9393
pandas.Series.item \
9494
pandas.Series.pipe \
9595
pandas.Series.mode \
96-
pandas.Series.sem \
97-
pandas.Series.skew \
9896
pandas.Series.is_unique \
9997
pandas.Series.is_monotonic_increasing \
10098
pandas.Series.is_monotonic_decreasing \
@@ -512,6 +510,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
512510
pandas.api.extensions.ExtensionArray._from_factorized \
513511
pandas.api.extensions.ExtensionArray._from_sequence \
514512
pandas.api.extensions.ExtensionArray._from_sequence_of_strings \
513+
pandas.api.extensions.ExtensionArray._hash_pandas_object \
515514
pandas.api.extensions.ExtensionArray._reduce \
516515
pandas.api.extensions.ExtensionArray._values_for_argsort \
517516
pandas.api.extensions.ExtensionArray._values_for_factorize \
@@ -541,8 +540,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
541540
pandas.DataFrame.keys \
542541
pandas.DataFrame.iterrows \
543542
pandas.DataFrame.pipe \
544-
pandas.DataFrame.sem \
545-
pandas.DataFrame.skew \
546543
pandas.DataFrame.backfill \
547544
pandas.DataFrame.pad \
548545
pandas.DataFrame.swapaxes \
@@ -557,21 +554,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
557554
pandas.DataFrame.__dataframe__
558555
RET=$(($RET + $?)) ; echo $MSG "DONE"
559556

560-
MSG='Partially validate docstrings (EX02)' ; echo $MSG
561-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX02 --ignore_functions \
562-
pandas.DataFrame.plot.line \
563-
pandas.Series.plot.line \
564-
pandas.api.types.is_datetime64_any_dtype \
565-
pandas.api.types.is_datetime64_ns_dtype \
566-
pandas.api.types.is_datetime64tz_dtype \
567-
pandas.plotting.andrews_curves \
568-
pandas.plotting.autocorrelation_plot \
569-
pandas.plotting.lag_plot \
570-
pandas.plotting.parallel_coordinates \
571-
pandas.plotting.radviz \
572-
pandas.tseries.frequencies.to_offset
573-
RET=$(($RET + $?)) ; echo $MSG "DONE"
574-
575557
fi
576558

577559
### DOCUMENTATION NOTEBOOKS ###

ci/deps/actions-310.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=0.29.32
9+
- cython>=0.29.33
1010

1111
# test dependencies
1212
- pytest>=7.0.0

ci/deps/actions-311.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=0.29.32
9+
- cython>=0.29.33
1010

1111
# test dependencies
1212
- pytest>=7.0.0

ci/deps/actions-38-downstream_compat.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77

88
# build dependencies
99
- versioneer[toml]
10-
- cython>=0.29.32
10+
- cython>=0.29.33
1111

1212
# test dependencies
1313
- pytest>=7.0.0

ci/deps/actions-38-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88

99
# build dependencies
1010
- versioneer[toml]
11-
- cython>=0.29.32
11+
- cython>=0.29.33
1212

1313
# test dependencies
1414
- pytest>=7.0.0

ci/deps/actions-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=0.29.32
9+
- cython>=0.29.33
1010

1111
# test dependencies
1212
- pytest>=7.0.0

ci/deps/actions-39.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=0.29.32
9+
- cython>=0.29.33
1010

1111
# test dependencies
1212
- pytest>=7.0.0

ci/deps/actions-pypy-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99

1010
# build dependencies
1111
- versioneer[toml]
12-
- cython>=0.29.32
12+
- cython>=0.29.33
1313

1414
# test dependencies
1515
- pytest>=7.0.0

ci/deps/circle-38-arm64.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=0.29.32
9+
- cython>=0.29.33
1010

1111
# test dependencies
1212
- pytest>=7.0.0

0 commit comments

Comments
 (0)