Skip to content

Commit 977d887

Browse files
authored
Merge branch 'main' into main
2 parents 660da5b + 6583c1d commit 977d887

File tree

5 files changed

+90
-13
lines changed

5 files changed

+90
-13
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ jobs:
181181
timeout-minutes: 90
182182
strategy:
183183
matrix:
184-
# Note: Don't use macOS latest since macos 14 appears to be arm64 only
185-
os: [macos-13, macos-14, windows-2025]
184+
os: [macos-15-intel, macos-15, windows-2025]
186185
env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml]
187186
fail-fast: false
188187
runs-on: ${{ matrix.os }}

.github/workflows/wheels.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ jobs:
9898
- [ubuntu-24.04, musllinux_x86_64]
9999
- [ubuntu-24.04-arm, manylinux_aarch64]
100100
- [ubuntu-24.04-arm, musllinux_aarch64]
101-
- [macos-13, macosx_x86_64]
102-
# Note: M1 images on Github Actions start from macOS 14
103-
- [macos-14, macosx_arm64]
104-
- [windows-2022, win_amd64]
101+
- [macos-15-intel, macosx_x86_64]
102+
- [macos-15, macosx_arm64]
103+
- [windows-2025, win_amd64]
105104
- [windows-11-arm, win_arm64]
106105
python: [["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"], ["cp314", "3.14"], ["cp314t", "3.14"]]
107106
include:

asv_bench/benchmarks/ctors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def gen_of_str(arr):
2323

2424

2525
def arr_dict(arr):
26-
return dict(zip(range(len(arr)), arr))
26+
return dict(zip(range(len(arr)), arr, strict=True))
2727

2828

2929
def list_of_tuples(arr):

asv_bench/benchmarks/series_methods.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setup(self):
1616
self.idx = date_range(
1717
start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
1818
)
19-
self.data = dict(zip(self.idx, range(len(self.idx))))
19+
self.data = dict(zip(self.idx, range(len(self.idx)), strict=True))
2020
self.array = np.array([1, 2, 3])
2121
self.idx2 = Index(["a", "b", "c"])
2222

@@ -407,7 +407,9 @@ def setup(self, num_to_replace):
407407
self.to_replace_list = np.random.choice(self.arr, num_to_replace)
408408
self.values_list = np.random.choice(self.arr1, num_to_replace)
409409

410-
self.replace_dict = dict(zip(self.to_replace_list, self.values_list))
410+
self.replace_dict = dict(
411+
zip(self.to_replace_list, self.values_list, strict=True)
412+
)
411413

412414
def time_replace_dict(self, num_to_replace):
413415
self.ser.replace(self.replace_dict)

pandas/core/indexes/multi.py

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
UnsortedIndexError,
5353
)
5454
from pandas.util._decorators import (
55-
Appender,
5655
cache_readonly,
5756
doc,
5857
set_module,
@@ -101,7 +100,6 @@
101100
import pandas.core.indexes.base as ibase
102101
from pandas.core.indexes.base import (
103102
Index,
104-
_index_shared_docs,
105103
ensure_index,
106104
get_unanimous_names,
107105
)
@@ -2290,7 +2288,6 @@ def _getitem_slice(self: MultiIndex, slobj: slice) -> MultiIndex:
22902288
verify_integrity=False,
22912289
)
22922290

2293-
@Appender(_index_shared_docs["take"] % _index_doc_kwargs)
22942291
def take(
22952292
self: MultiIndex,
22962293
indices,
@@ -2299,6 +2296,51 @@ def take(
22992296
fill_value=None,
23002297
**kwargs,
23012298
) -> MultiIndex:
2299+
"""
2300+
Return a new MultiIndex of the values selected by the indices.
2301+
2302+
For internal compatibility with numpy arrays.
2303+
2304+
Parameters
2305+
----------
2306+
indices : array-like
2307+
Indices to be taken.
2308+
axis : int, optional
2309+
The axis over which to select values, always 0.
2310+
allow_fill : bool, default True
2311+
How to handle negative values in `indices`.
2312+
2313+
* False: negative values in `indices` indicate positional indices
2314+
from the right (the default). This is similar to
2315+
:func:`numpy.take`.
2316+
2317+
* True: negative values in `indices` indicate
2318+
missing values. These values are set to `fill_value`. Any other
2319+
other negative values raise a ``ValueError``.
2320+
2321+
fill_value : scalar, default None
2322+
If allow_fill=True and fill_value is not None, indices specified by
2323+
-1 are regarded as NA. If Index doesn't hold NA, raise ValueError.
2324+
**kwargs
2325+
Required for compatibility with numpy.
2326+
2327+
Returns
2328+
-------
2329+
Index
2330+
An index formed of elements at the given indices. Will be the same
2331+
type as self, except for RangeIndex.
2332+
2333+
See Also
2334+
--------
2335+
numpy.ndarray.take: Return an array formed from the
2336+
elements of a at the given indices.
2337+
2338+
Examples
2339+
--------
2340+
>>> idx = pd.Index(["a", "b", "c"])
2341+
>>> idx.take([2, 2, 1, 2])
2342+
Index(['c', 'c', 'b', 'c'], dtype='str')
2343+
"""
23022344
nv.validate_take((), kwargs)
23032345
indices = ensure_platform_int(indices)
23042346

@@ -2454,8 +2496,43 @@ def argsort(
24542496
keys = [lev.codes for lev in target._get_codes_for_sorting()]
24552497
return lexsort_indexer(keys, na_position=na_position, codes_given=True)
24562498

2457-
@Appender(_index_shared_docs["repeat"] % _index_doc_kwargs)
24582499
def repeat(self, repeats: int, axis=None) -> MultiIndex:
2500+
"""
2501+
Repeat elements of a MultiIndex.
2502+
2503+
Returns a new MultiIndex where each element of the current MultiIndex
2504+
is repeated consecutively a given number of times.
2505+
2506+
Parameters
2507+
----------
2508+
repeats : int or array of ints
2509+
The number of repetitions for each element. This should be a
2510+
non-negative integer. Repeating 0 times will return an empty
2511+
MultiIndex.
2512+
axis : None
2513+
Must be ``None``. Has no effect but is accepted for compatibility
2514+
with numpy.
2515+
2516+
Returns
2517+
-------
2518+
MultiIndex
2519+
Newly created MultiIndex with repeated elements.
2520+
2521+
See Also
2522+
--------
2523+
Series.repeat : Equivalent function for Series.
2524+
numpy.repeat : Similar method for :class:`numpy.ndarray`.
2525+
2526+
Examples
2527+
--------
2528+
>>> idx = pd.Index(["a", "b", "c"])
2529+
>>> idx
2530+
Index(['a', 'b', 'c'], dtype='object')
2531+
>>> idx.repeat(2)
2532+
Index(['a', 'a', 'b', 'b', 'c', 'c'], dtype='object')
2533+
>>> idx.repeat([1, 2, 3])
2534+
Index(['a', 'b', 'b', 'c', 'c', 'c'], dtype='object')
2535+
"""
24592536
nv.validate_repeat((), {"axis": axis})
24602537
# error: Incompatible types in assignment (expression has type "ndarray",
24612538
# variable has type "int")

0 commit comments

Comments
 (0)