Skip to content

Commit 98d248c

Browse files
committed
Merge branch 'main' into patch-2
2 parents 71e8a6d + a45c7fa commit 98d248c

File tree

358 files changed

+7646
-3200
lines changed

Some content is hidden

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

358 files changed

+7646
-3200
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
PANDAS_CI: "1"
1414
steps:
1515
- checkout
16-
- run: ci/setup_env.sh
16+
- run: .circleci/setup_env.sh
1717
- run: PATH=$HOME/miniconda3/envs/pandas-dev/bin:$HOME/miniconda3/condabin:$PATH ci/run_tests.sh
1818

1919
workflows:
File renamed without changes.

.github/PULL_REQUEST_TEMPLATE.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- [ ] closes #xxxx (Replace xxxx with the Github issue number)
22
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
33
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
4+
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
45
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Set up Conda environment
2+
inputs:
3+
environment-file:
4+
description: Conda environment file to use.
5+
default: environment.yml
6+
environment-name:
7+
description: Name to use for the Conda environment
8+
default: test
9+
python-version:
10+
description: Python version to install
11+
required: false
12+
pyarrow-version:
13+
description: If set, overrides the PyArrow version in the Conda environment to the given string.
14+
required: false
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Set Arrow version in ${{ inputs.environment-file }} to ${{ inputs.pyarrow-version }}
19+
run: |
20+
grep -q ' - pyarrow' ${{ inputs.environment-file }}
21+
sed -i"" -e "s/ - pyarrow/ - pyarrow=${{ inputs.pyarrow-version }}/" ${{ inputs.environment-file }}
22+
cat ${{ inputs.environment-file }}
23+
shell: bash
24+
if: ${{ inputs.pyarrow-version }}
25+
26+
- name: Install ${{ inputs.environment-file }}
27+
uses: conda-incubator/[email protected]
28+
with:
29+
environment-file: ${{ inputs.environment-file }}
30+
activate-environment: ${{ inputs.environment-name }}
31+
python-version: ${{ inputs.python-version }}
32+
channel-priority: ${{ runner.os == 'macOS' && 'flexible' || 'strict' }}
33+
channels: conda-forge
34+
mamba-version: "0.24"
35+
use-mamba: true
36+
use-only-tar-bz2: true
37+
condarc-file: ci/condarc.yml

.github/actions/setup/action.yml

-12
This file was deleted.

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

+6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ jobs:
2323

2424
- name: Run 32-bit manylinux2014 Docker Build / Tests
2525
run: |
26+
# Without this (line 34), versioneer will not be able to determine the pandas version.
27+
# This is because of a security update to git that blocks it from reading the config folder if
28+
# it is not owned by the current user. We hit this since the "mounted" folder is not hit by the
29+
# Docker container.
30+
# xref https://github.com/pypa/manylinux/issues/1309
2631
docker pull quay.io/pypa/manylinux2014_i686
2732
docker run --platform linux/386 -v $(pwd):/pandas quay.io/pypa/manylinux2014_i686 \
2833
/bin/bash -xc "cd pandas && \
34+
git config --global --add safe.directory /pandas && \
2935
/opt/python/cp38-cp38/bin/python -m venv ~/virtualenvs/pandas-dev && \
3036
. ~/virtualenvs/pandas-dev/bin/activate && \
3137
python -m pip install --no-deps -U pip wheel 'setuptools<60.0.0' && \

.github/workflows/asv-bot.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,8 @@ jobs:
4141

4242
# Although asv sets up its own env, deps are still needed
4343
# during discovery process
44-
- uses: conda-incubator/[email protected]
45-
with:
46-
activate-environment: pandas-dev
47-
channel-priority: strict
48-
environment-file: ${{ env.ENV_FILE }}
49-
use-only-tar-bz2: true
44+
- name: Set up Conda
45+
uses: ./.github/actions/setup-conda
5046

5147
- name: Run benchmarks
5248
id: bench

.github/workflows/code-checks.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,8 @@ jobs:
5858
path: ~/conda_pkgs_dir
5959
key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }}
6060

61-
- uses: conda-incubator/[email protected]
62-
with:
63-
mamba-version: "*"
64-
channels: conda-forge
65-
activate-environment: pandas-dev
66-
channel-priority: strict
67-
environment-file: ${{ env.ENV_FILE }}
68-
use-only-tar-bz2: true
61+
- name: Set up Conda
62+
uses: ./.github/actions/setup-conda
6963

7064
- name: Build Pandas
7165
id: build
@@ -127,14 +121,8 @@ jobs:
127121
path: ~/conda_pkgs_dir
128122
key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }}
129123

130-
- uses: conda-incubator/[email protected]
131-
with:
132-
mamba-version: "*"
133-
channels: conda-forge
134-
activate-environment: pandas-dev
135-
channel-priority: strict
136-
environment-file: ${{ env.ENV_FILE }}
137-
use-only-tar-bz2: true
124+
- name: Set up Conda
125+
uses: ./.github/actions/setup-conda
138126

139127
- name: Build Pandas
140128
id: build

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

+14-11
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,46 @@ jobs:
2424
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-web-docs
2525
cancel-in-progress: true
2626

27+
defaults:
28+
run:
29+
shell: bash -el {0}
30+
2731
steps:
2832
- name: Checkout
2933
uses: actions/checkout@v3
3034
with:
3135
fetch-depth: 0
3236

33-
- name: Set up pandas
34-
uses: ./.github/actions/setup
37+
- name: Set up Conda
38+
uses: ./.github/actions/setup-conda
39+
40+
- name: Build Pandas
41+
uses: ./.github/actions/build_pandas
3542

3643
- name: Build website
37-
run: |
38-
source activate pandas-dev
39-
python web/pandas_web.py web/pandas --target-path=web/build
44+
run: python web/pandas_web.py web/pandas --target-path=web/build
4045

4146
- name: Build documentation
42-
run: |
43-
source activate pandas-dev
44-
doc/make.py --warnings-are-errors
47+
run: doc/make.py --warnings-are-errors
4548

4649
- name: Install ssh key
4750
run: |
4851
mkdir -m 700 -p ~/.ssh
4952
echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa
5053
chmod 600 ~/.ssh/id_rsa
5154
echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE1Kkopomm7FHG5enATf7SgnpICZ4W2bw+Ho+afqin+w7sMcrsa0je7sbztFAV8YchDkiBKnWTG4cRT+KZgZCaY=" > ~/.ssh/known_hosts
52-
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
55+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5356

5457
- name: Copy cheatsheets into site directory
5558
run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/
5659

5760
- name: Upload web
5861
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' web/build/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas
59-
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
62+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
6063

6164
- name: Upload dev docs
6265
run: rsync -az --delete doc/build/html/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas/pandas-docs/dev
63-
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
66+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
6467

6568
- name: Move docs into site directory
6669
run: mv doc/build/html web/build/docs

.github/workflows/macos-windows.yml

+3-17
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,18 @@ jobs:
4343
with:
4444
fetch-depth: 0
4545

46-
- name: Install Dependencies
47-
uses: conda-incubator/setup-[email protected]
46+
- name: Set up Conda
47+
uses: ./.github/actions/setup-conda
4848
with:
49-
mamba-version: "*"
50-
channels: conda-forge
51-
activate-environment: pandas-dev
52-
channel-priority: ${{ matrix.os == 'macos-latest' && 'flexible' || 'strict' }}
5349
environment-file: ci/deps/${{ matrix.env_file }}
54-
use-only-tar-bz2: true
55-
56-
# ImportError: 2): Library not loaded: @rpath/libssl.1.1.dylib
57-
# Referenced from: /Users/runner/miniconda3/envs/pandas-dev/lib/libthrift.0.13.0.dylib
58-
# Reason: image not found
59-
- name: Upgrade pyarrow on MacOS
60-
run: conda install -n pandas-dev -c conda-forge --no-update-deps pyarrow=6
61-
if: ${{ matrix.os == 'macos-latest' }}
50+
pyarrow-version: ${{ matrix.os == 'macos-latest' && '6' || '' }}
6251

6352
- name: Build Pandas
6453
uses: ./.github/actions/build_pandas
6554

6655
- name: Test
6756
run: ci/run_tests.sh
6857

69-
- name: Build Version
70-
run: conda list
71-
7258
- name: Publish test results
7359
uses: actions/upload-artifact@v3
7460
with:

.github/workflows/posix.yml

+3-10
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,11 @@ jobs:
147147
# xsel for clipboard tests
148148
run: sudo apt-get update && sudo apt-get install -y libc6-dev-i386 xsel ${{ env.EXTRA_APT }}
149149

150-
- uses: conda-incubator/[email protected]
150+
- name: Set up Conda
151+
uses: ./.github/actions/setup-conda
151152
with:
152-
mamba-version: "*"
153-
channels: conda-forge
154-
activate-environment: pandas-dev
155-
channel-priority: flexible
156153
environment-file: ${{ env.ENV_FILE }}
157-
use-only-tar-bz2: true
158-
159-
- name: Upgrade Arrow version
160-
run: conda install -n pandas-dev -c conda-forge --no-update-deps pyarrow=${{ matrix.pyarrow_version }}
161-
if: ${{ matrix.pyarrow_version }}
154+
pyarrow-version: ${{ matrix.pyarrow_version }}
162155

163156
- name: Build Pandas
164157
uses: ./.github/actions/build_pandas

.github/workflows/sdist.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ jobs:
5959
name: ${{matrix.python-version}}-sdist.gz
6060
path: dist/*.gz
6161

62-
- uses: conda-incubator/[email protected]
62+
- name: Set up Conda
63+
uses: ./.github/actions/setup-conda
6364
with:
64-
activate-environment: pandas-sdist
65-
channels: conda-forge
66-
python-version: '${{ matrix.python-version }}'
65+
environment-file: ""
66+
environment-name: pandas-sdist
67+
python-version: ${{ matrix.python-version }}
6768

6869
- name: Install pandas from sdist
6970
run: |
@@ -74,9 +75,9 @@ jobs:
7475
run: |
7576
case "${{matrix.python-version}}" in
7677
3.8)
77-
pip install numpy==1.18.5 ;;
78+
pip install numpy==1.19.5 ;;
7879
3.9)
79-
pip install numpy==1.19.3 ;;
80+
pip install numpy==1.19.5 ;;
8081
3.10)
8182
pip install numpy==1.21.2 ;;
8283
esac

.pre-commit-config.yaml

+16-5
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.3'
14+
rev: 'v2.4'
1515
hooks:
1616
- id: vulture
1717
entry: python scripts/run_vulture.py
@@ -26,7 +26,6 @@ repos:
2626
hooks:
2727
- id: codespell
2828
types_or: [python, rst, markdown]
29-
files: ^(pandas|doc)/
3029
- repo: https://github.com/pre-commit/pre-commit-hooks
3130
rev: v4.2.0
3231
hooks:
@@ -60,7 +59,7 @@ repos:
6059
hooks:
6160
- id: isort
6261
- repo: https://github.com/asottile/pyupgrade
63-
rev: v2.32.0
62+
rev: v2.32.1
6463
hooks:
6564
- id: pyupgrade
6665
args: [--py38-plus]
@@ -75,7 +74,7 @@ repos:
7574
types: [text] # overwrite types: [rst]
7675
types_or: [python, rst]
7776
- repo: https://github.com/sphinx-contrib/sphinx-lint
78-
rev: v0.4.1
77+
rev: v0.6
7978
hooks:
8079
- id: sphinx-lint
8180
- repo: https://github.com/asottile/yesqa
@@ -93,7 +92,19 @@ repos:
9392
pass_filenames: false
9493
types: [python]
9594
stages: [manual]
96-
additional_dependencies: ['[email protected]']
95+
additional_dependencies: &pyright_dependencies
96+
97+
- repo: local
98+
hooks:
99+
- id: pyright_reportGeneralTypeIssues
100+
name: pyright reportGeneralTypeIssues
101+
entry: pyright --skipunannotated -p pyright_reportGeneralTypeIssues.json
102+
# note: assumes python env is setup and activated
103+
language: node
104+
pass_filenames: false
105+
types: [python]
106+
stages: [manual]
107+
additional_dependencies: *pyright_dependencies
97108
- repo: local
98109
hooks:
99110
- id: mypy

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

asv_bench/benchmarks/frame_ctor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def setup(self):
3737
self.dict_list = frame.to_dict(orient="records")
3838
self.data2 = {i: {j: float(j) for j in range(100)} for i in range(2000)}
3939

40-
# arrays which we wont consolidate
40+
# arrays which we won't consolidate
4141
self.dict_of_categoricals = {i: Categorical(np.arange(N)) for i in range(K)}
4242

4343
def time_list_of_dict(self):
@@ -60,7 +60,7 @@ def time_nested_dict_int64(self):
6060
DataFrame(self.data2)
6161

6262
def time_dict_of_categoricals(self):
63-
# dict of arrays that we wont consolidate
63+
# dict of arrays that we won't consolidate
6464
DataFrame(self.dict_of_categoricals)
6565

6666

asv_bench/benchmarks/frame_methods.py

+20
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,26 @@ def time_values_mixed_wide(self):
288288
self.df_mixed_wide.values
289289

290290

291+
class ToRecords:
292+
def setup(self):
293+
N = 100_000
294+
data = np.random.randn(N, 2)
295+
mi = MultiIndex.from_arrays(
296+
[
297+
np.arange(N),
298+
date_range("1970-01-01", periods=N, freq="ms"),
299+
]
300+
)
301+
self.df = DataFrame(data)
302+
self.df_mi = DataFrame(data, index=mi)
303+
304+
def time_to_records(self):
305+
self.df.to_records(index=True)
306+
307+
def time_to_records_multiindex(self):
308+
self.df_mi.to_records(index=True)
309+
310+
291311
class Repr:
292312
def setup(self):
293313
nrows = 10000

0 commit comments

Comments
 (0)