Skip to content

Commit 1cc352a

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 64feddd + 6466fc6 commit 1cc352a

File tree

96 files changed

+1029
-1295
lines changed

Some content is hidden

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

96 files changed

+1029
-1295
lines changed

.github/workflows/datamanger.yml

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

.github/workflows/posix.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,45 @@ jobs:
3333
- env_file: actions-38-downstream_compat.yaml
3434
pattern: "not slow and not network and not single_cpu"
3535
pytest_target: "pandas/tests/test_downstream.py"
36+
name: "Downstream Compat"
3637
- env_file: actions-38-minimum_versions.yaml
3738
pattern: "not slow and not network and not single_cpu"
39+
name: "Minimum Versions"
3840
- env_file: actions-38.yaml
3941
pattern: "not slow and not network and not single_cpu"
4042
extra_apt: "language-pack-it"
4143
lang: "it_IT.utf8"
4244
lc_all: "it_IT.utf8"
45+
name: "Locale: it_IT.utf8"
4346
- env_file: actions-38.yaml
4447
pattern: "not slow and not network and not single_cpu"
4548
extra_apt: "language-pack-zh-hans"
4649
lang: "zh_CN.utf8"
4750
lc_all: "zh_CN.utf8"
51+
name: "Locale: zh_CN.utf8"
52+
- env_file: actions-38.yaml
53+
pattern: "not slow and not network and not single_cpu"
54+
pandas_data_manager: "array"
55+
name: "Data Manager"
4856
- env_file: actions-pypy-38.yaml
4957
pattern: "not slow and not network and not single_cpu"
5058
test_args: "--max-worker-restart 0"
59+
name: "Pypy"
5160
- env_file: actions-310-numpydev.yaml
5261
pattern: "not slow and not network and not single_cpu"
5362
pandas_testing_mode: "deprecate"
5463
test_args: "-W error"
64+
name: "Numpy Dev"
5565
fail-fast: false
66+
name: ${{ matrix.name || format('{0} pyarrow={1} {2}', matrix.env_file, matrix.pyarrow_version, matrix.pattern) }}
5667
env:
5768
ENV_FILE: ci/deps/${{ matrix.env_file }}
5869
PATTERN: ${{ matrix.pattern }}
5970
EXTRA_APT: ${{ matrix.extra_apt || '' }}
6071
LANG: ${{ matrix.lang || '' }}
6172
LC_ALL: ${{ matrix.lc_all || '' }}
6273
PANDAS_TESTING_MODE: ${{ matrix.pandas_testing_mode || '' }}
74+
PANDAS_DATA_MANAGER: ${{ matrix.pandas_data_manager || 'block' }}
6375
TEST_ARGS: ${{ matrix.test_args || '' }}
6476
PYTEST_WORKERS: ${{ contains(matrix.pattern, 'not single_cpu') && 'auto' || '1' }}
6577
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}
@@ -68,7 +80,7 @@ jobs:
6880
COVERAGE: ${{ !contains(matrix.env_file, 'pypy') }}
6981
concurrency:
7082
# https://github.community/t/concurrecy-not-work-for-push/183068/7
71-
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.pyarrow_version || '' }}-${{ matrix.extra_apt || '' }}
83+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.pyarrow_version || '' }}-${{ matrix.extra_apt || '' }}-${{ matrix.pandas_data_manager || '' }}
7284
cancel-in-progress: true
7385

7486
services:

.github/workflows/sdist.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ on:
99
branches:
1010
- main
1111
- 1.4.x
12+
types: [labeled, opened, synchronize, reopened]
1213
paths-ignore:
1314
- "doc/**"
1415

1516
jobs:
1617
build:
18+
if: ${{ github.event.label.name == 'Build' || contains(github.event.pull_request.labels.*.name, 'Build') || github.event_name == 'push'}}
1719
runs-on: ubuntu-latest
1820
timeout-minutes: 60
1921
defaults:

asv_bench/benchmarks/indexing.py

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
CategoricalIndex,
1414
DataFrame,
1515
Float64Index,
16-
IndexSlice,
1716
Int64Index,
1817
IntervalIndex,
1918
MultiIndex,
@@ -200,28 +199,69 @@ def time_take(self, index):
200199

201200

202201
class MultiIndexing:
203-
def setup(self):
204-
mi = MultiIndex.from_product([range(1000), range(1000)])
205-
self.s = Series(np.random.randn(1000000), index=mi)
206-
self.df = DataFrame(self.s)
207202

208-
n = 100000
209-
with warnings.catch_warnings(record=True):
210-
self.mdt = DataFrame(
211-
{
212-
"A": np.random.choice(range(10000, 45000, 1000), n),
213-
"B": np.random.choice(range(10, 400), n),
214-
"C": np.random.choice(range(1, 150), n),
215-
"D": np.random.choice(range(10000, 45000), n),
216-
"x": np.random.choice(range(400), n),
217-
"y": np.random.choice(range(25), n),
218-
}
219-
)
220-
self.idx = IndexSlice[20000:30000, 20:30, 35:45, 30000:40000]
221-
self.mdt = self.mdt.set_index(["A", "B", "C", "D"]).sort_index()
203+
params = [True, False]
204+
param_names = ["unique_levels"]
205+
206+
def setup(self, unique_levels):
207+
self.ndim = 2
208+
if unique_levels:
209+
mi = MultiIndex.from_arrays([range(1000000)] * self.ndim)
210+
else:
211+
mi = MultiIndex.from_product([range(1000)] * self.ndim)
212+
self.df = DataFrame(np.random.randn(len(mi)), index=mi)
213+
214+
self.tgt_slice = slice(200, 800)
215+
self.tgt_null_slice = slice(None)
216+
self.tgt_list = list(range(0, 1000, 10))
217+
self.tgt_scalar = 500
218+
219+
bool_indexer = np.zeros(len(mi), dtype=np.bool_)
220+
bool_indexer[slice(0, len(mi), 100)] = True
221+
self.tgt_bool_indexer = bool_indexer
222+
223+
def time_loc_partial_key_slice(self, unique_levels):
224+
self.df.loc[self.tgt_slice, :]
225+
226+
def time_loc_partial_key_null_slice(self, unique_levels):
227+
self.df.loc[self.tgt_null_slice, :]
228+
229+
def time_loc_partial_key_list(self, unique_levels):
230+
self.df.loc[self.tgt_list, :]
231+
232+
def time_loc_partial_key_scalar(self, unique_levels):
233+
self.df.loc[self.tgt_scalar, :]
234+
235+
def time_loc_partial_bool_indexer(self, unique_levels):
236+
self.df.loc[self.tgt_bool_indexer, :]
237+
238+
def time_loc_all_slices(self, unique_levels):
239+
target = tuple([self.tgt_slice] * self.ndim)
240+
self.df.loc[target, :]
241+
242+
def time_loc_all_null_slices(self, unique_levels):
243+
target = tuple([self.tgt_null_slice] * self.ndim)
244+
self.df.loc[target, :]
245+
246+
def time_loc_all_lists(self, unique_levels):
247+
target = tuple([self.tgt_list] * self.ndim)
248+
self.df.loc[target, :]
249+
250+
def time_loc_all_scalars(self, unique_levels):
251+
target = tuple([self.tgt_scalar] * self.ndim)
252+
self.df.loc[target, :]
253+
254+
def time_loc_all_bool_indexers(self, unique_levels):
255+
target = tuple([self.tgt_bool_indexer] * self.ndim)
256+
self.df.loc[target, :]
257+
258+
def time_loc_slice_plus_null_slice(self, unique_levels):
259+
target = (self.tgt_slice, self.tgt_null_slice)
260+
self.df.loc[target, :]
222261

223-
def time_index_slice(self):
224-
self.mdt.loc[self.idx, :]
262+
def time_loc_null_slice_plus_slice(self, unique_levels):
263+
target = (self.tgt_null_slice, self.tgt_slice)
264+
self.df.loc[target, :]
225265

226266

227267
class IntervalIndexing:

azure-pipelines.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ variables:
2222
PANDAS_CI: 1
2323

2424
jobs:
25-
# Mac and Linux use the same template
2625
- template: ci/azure/posix.yml
2726
parameters:
2827
name: macOS

ci/azure/posix.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,35 @@ jobs:
1010
strategy:
1111
matrix:
1212
py38:
13-
ENV_FILE: ci/deps/azure-macos-38.yaml
13+
ENV_FILE: ci/deps/actions-38.yaml
1414
CONDA_PY: "38"
1515

1616
py39:
17-
ENV_FILE: ci/deps/azure-macos-39.yaml
17+
ENV_FILE: ci/deps/actions-39.yaml
1818
CONDA_PY: "39"
1919

2020
py310:
21-
ENV_FILE: ci/deps/azure-macos-310.yaml
21+
ENV_FILE: ci/deps/actions-310.yaml
2222
CONDA_PY: "310"
2323

2424
steps:
2525
- script: echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
2626
displayName: 'Set conda path'
2727

28+
- script: rm /usr/local/miniconda/pkgs/cache/*.json
29+
displayName: 'Workaround for mamba-org/mamba#488'
30+
2831
- script: ci/setup_env.sh
2932
displayName: 'Setup environment and build pandas'
3033

3134
- script: |
32-
source activate pandas-dev
33-
ci/run_tests.sh
35+
conda run -n pandas-dev --no-capture-output ci/run_tests.sh
3436
displayName: 'Test'
3537
36-
- script: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
38+
- script: |
39+
pushd /tmp
40+
conda run -n pandas-dev python -c "import pandas; pandas.show_versions()"
41+
popd
3742
displayName: 'Build versions'
3843
3944
- task: PublishTestResults@2

ci/azure/windows.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,22 @@ jobs:
2626
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
2727
Write-Host "##vso[task.prependpath]$HOME/miniconda3/bin"
2828
displayName: 'Add conda to PATH'
29-
- script: conda update -q -n base conda
30-
displayName: 'Update conda'
29+
- bash: conda install -yv -c conda-forge -n base 'mamba>=0.21.2'
30+
displayName: 'Install mamba'
3131

3232
- bash: |
33-
conda env create -q --file ci\\deps\\actions-$(CONDA_PY).yaml
33+
# See https://github.com/mamba-org/mamba/issues/1370
34+
# See https://github.com/mamba-org/mamba/issues/633
35+
C:\\Miniconda\\condabin\\mamba.bat create -n pandas-dev
36+
C:\\Miniconda\\condabin\\mamba.bat env update -n pandas-dev --file ci\\deps\\actions-$(CONDA_PY).yaml
37+
# TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941
38+
C:\\Miniconda\\condabin\\mamba.bat install -n pandas-dev 'setuptools<60'
39+
C:\\Miniconda\\condabin\\mamba.bat list -n pandas-dev
3440
displayName: 'Create anaconda environment'
3541
- bash: |
3642
source activate pandas-dev
3743
conda list
38-
python setup.py build_ext -q -j 4
44+
python setup.py build_ext -q -j 2
3945
python -m pip install --no-build-isolation -e .
4046
displayName: 'Build'
4147
- bash: |

ci/deps/azure-macos-310.yaml

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

ci/deps/azure-macos-38.yaml

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

0 commit comments

Comments
 (0)