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
Lines changed: 31 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 22 additions & 0 deletions
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

Lines changed: 6 additions & 4 deletions
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

Lines changed: 0 additions & 4 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 12 additions & 18 deletions
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

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

asv_bench/benchmarks/frame_methods.py

Lines changed: 18 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 29 additions & 0 deletions
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

0 commit comments

Comments
 (0)