Skip to content

Commit 95e7f11

Browse files
More improvements in the indexes
1 parent 63fc9fa commit 95e7f11

File tree

10 files changed

+17
-28
lines changed

10 files changed

+17
-28
lines changed

pandas-stubs/core/indexes/accessors.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ class _DatetimeOtherOps(Generic[_DTOtherOpsDateReturnType, _DTOtherOpsTimeReturn
140140
@property
141141
def timetz(self) -> _DTOtherOpsTimeReturnType: ...
142142

143-
class DatetimeAndPeriodProperties(_DatetimeFieldOps[Series[int]]): ...
144143
class _DatetimeLikeOps(
145144
_DatetimeFieldOps[_DTFieldOpsReturnType],
146145
_DatetimeObjectOps[_DTFreqReturnType],

pandas-stubs/core/indexes/base.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ class Index(IndexOpsMixin[S1]):
279279
@final
280280
def is_(self, other) -> bool: ...
281281
def __len__(self) -> int: ...
282-
def __array__(self, dtype=...) -> np.ndarray: ...
282+
def __array__(
283+
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
284+
) -> np.ndarray: ...
283285
def __array_wrap__(self, result, context=...): ...
284286
@property
285287
def dtype(self) -> DtypeObj: ...
@@ -312,9 +314,9 @@ class Index(IndexOpsMixin[S1]):
312314
def names(self, names: Sequence[Hashable]) -> None: ...
313315
def set_names(self, names, *, level=..., inplace: bool = ...): ...
314316
@overload
315-
def rename(self, name, inplace: Literal[False] = False) -> Self: ...
317+
def rename(self, name, *, inplace: Literal[False] = False) -> Self: ...
316318
@overload
317-
def rename(self, name, inplace: Literal[True]) -> None: ...
319+
def rename(self, name, *, inplace: Literal[True]) -> None: ...
318320
@property
319321
def nlevels(self) -> int: ...
320322
def get_level_values(self, level: int | _str) -> Index: ...

pandas-stubs/core/indexes/category.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate):
4040
self, dtype: DtypeArg = ..., copy: bool | None = ...
4141
) -> np.ndarray: ...
4242
def astype(self, dtype: DtypeArg, copy: bool = ...) -> Index: ...
43-
def fillna(self, value=...): ...
4443
@property
4544
def is_unique(self) -> bool: ...
4645
@property

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties):
5555
copy: bool = ...,
5656
name: Hashable = ...,
5757
) -> None: ...
58-
def __array__(self, dtype=...) -> np.ndarray: ...
5958
def __reduce__(self): ...
6059
# various ignores needed for mypy, as we do want to restrict what can be used in
6160
# arithmetic for these types

pandas-stubs/core/indexes/interval.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
221221
def memory_usage(self, deep: bool = ...) -> int: ...
222222
@property
223223
def is_overlapping(self) -> bool: ...
224-
# Note: tolerance no effect. It is included in all get_loc so
225-
# that signatures are consistent with base even though it is usually not used
226-
def get_loc(
227-
self,
228-
key: Label,
229-
method: FillnaOptions | Literal["nearest"] | None = ...,
230-
tolerance=...,
231-
) -> int | slice | npt.NDArray[np.bool_]: ...
224+
def get_loc(self, key: Label) -> int | slice | npt.NDArray[np.bool_]: ...
232225
@final
233226
def get_indexer(
234227
self,

pandas-stubs/core/indexes/multi.pyi

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,28 @@ class MultiIndex(Index):
4545
cls,
4646
arrays: Sequence[Axes],
4747
sortorder: int | None = ...,
48-
names: SequenceNotStr[Hashable] = ...,
48+
names: SequenceNotStr[Hashable] | None = ...,
4949
) -> Self: ...
5050
@classmethod
5151
def from_tuples(
5252
cls,
5353
tuples: Iterable[tuple[Hashable, ...]],
5454
sortorder: int | None = ...,
55-
names: SequenceNotStr[Hashable] = ...,
55+
names: SequenceNotStr[Hashable] | None = ...,
5656
) -> Self: ...
5757
@classmethod
5858
def from_product(
5959
cls,
6060
iterables: Sequence[SequenceNotStr[Hashable] | pd.Series | pd.Index],
6161
sortorder: int | None = ...,
62-
names: SequenceNotStr[Hashable] = ...,
62+
names: SequenceNotStr[Hashable] | None = ...,
6363
) -> Self: ...
6464
@classmethod
6565
def from_frame(
6666
cls,
6767
df: pd.DataFrame,
6868
sortorder: int | None = ...,
69-
names: SequenceNotStr[Hashable] = ...,
69+
names: SequenceNotStr[Hashable] | None = ...,
7070
) -> Self: ...
7171
@property
7272
def shape(self): ...
@@ -76,10 +76,9 @@ class MultiIndex(Index):
7676
@property
7777
def codes(self): ...
7878
def set_codes(self, codes, *, level=..., verify_integrity: bool = ...): ...
79-
def copy( # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore
80-
self, names=..., deep: bool = ...
79+
def copy( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore
80+
self, names: SequenceNotStr[Hashable] = ..., deep: bool = ..., name: None = ...
8181
) -> Self: ...
82-
def __array__(self, dtype=...) -> np.ndarray: ...
8382
def view(self, cls=...): ...
8483
def __contains__(self, key) -> bool: ...
8584
@property
@@ -136,7 +135,7 @@ class MultiIndex(Index):
136135
self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs
137136
): ...
138137
def append(self, other): ...
139-
def argsort(self, *args, **kwargs): ...
138+
def argsort(self, *args, na_position: NaPosition = ..., **kwargs): ...
140139
def repeat(self, repeats, axis=...): ...
141140
@final
142141
def where(self, cond, other=...) -> None: ...

pandas-stubs/core/indexes/period.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ from typing import (
55
overload,
66
)
77

8-
import numpy as np
98
import pandas as pd
109
from pandas import Index
1110
from pandas.core.indexes.accessors import PeriodIndexFieldOps
@@ -53,7 +52,6 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps):
5352
def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride]
5453
self, other: NaTType
5554
) -> NaTType: ...
56-
def __array__(self, dtype=...) -> np.ndarray: ...
5755
@final
5856
def __array_wrap__(self, result, context=...): ...
5957
def asof_locs(self, where, mask): ...

pandas-stubs/core/indexes/range.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RangeIndex(Index[int]):
5353
@final
5454
def get_indexer(self, target, method=..., limit=..., tolerance=...): ...
5555
def tolist(self): ...
56-
def copy(self, name: Hashable = ..., deep: bool = ..., dtype=..., **kwargs): ...
56+
def copy(self, name: Hashable = ..., deep: bool = ...): ...
5757
def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
5858
def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ...
5959
def argsort(self, *args, **kwargs): ...
@@ -75,8 +75,8 @@ class RangeIndex(Index[int]):
7575
@property
7676
def size(self) -> int: ...
7777
def __floordiv__(self, other): ...
78-
def all(self) -> bool: ...
79-
def any(self) -> bool: ...
78+
def all(self, *args, **kwargs) -> bool: ...
79+
def any(self, *args, **kwargs) -> bool: ...
8080
@final
8181
def union( # pyrefly: ignore
8282
self, other: list[HashableT] | Index, sort=...

pandas-stubs/core/ops/docstrings.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
reverse_op = ...

pandas-stubs/core/window/rolling.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class RollingAndExpandingMixin(BaseWindow[NDFrameT]):
9797
def max(
9898
self,
9999
numeric_only: bool = ...,
100+
*args,
100101
engine: WindowingEngine = ...,
101102
engine_kwargs: WindowingEngineKwargs = ...,
102103
) -> NDFrameT: ...

0 commit comments

Comments
 (0)