Skip to content

Commit 05d5147

Browse files
committed
Type Index methods: droplevel, __reduce__, isna, isnull,
`notna`, `notnull`, `fillna`, `memory_usage`, `__setitem__`, `equals`, `identical`
1 parent 50bed6e commit 05d5147

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

pandas-stubs/core/indexes/base.pyi

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
351351
Index,
352352
]: ...
353353
@final
354-
def is_(self, other: object) -> bool: ...
354+
def is_(self, other: Any) -> bool: ...
355355
def __len__(self) -> int: ...
356356
def __array__(
357357
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
@@ -403,7 +403,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
403403
@property
404404
def nlevels(self) -> int: ...
405405
def get_level_values(self, level: int | _str) -> Index: ...
406-
def droplevel(self, level: Level | list[Level] = 0): ...
406+
def droplevel(self, level: Level | Sequence[Level] = 0) -> Self: ...
407407
@property
408408
def is_monotonic_increasing(self) -> bool: ...
409409
@property
@@ -414,16 +414,15 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
414414
def has_duplicates(self) -> bool: ...
415415
@property
416416
def inferred_type(self) -> _str: ...
417-
def __reduce__(self): ...
418417
@property
419418
def hasnans(self) -> bool: ...
420419
@final
421-
def isna(self): ...
422-
isnull = ...
420+
def isna(self) -> Index[bool]: ...
421+
isnull = isna
423422
@final
424-
def notna(self): ...
425-
notnull = ...
426-
def fillna(self, value=...): ...
423+
def notna(self) -> Index[bool]: ...
424+
notnull = notna
425+
def fillna(self, value: Scalar) -> Index: ...
427426
def dropna(self, how: AnyAll = "any") -> Self: ...
428427
def unique(self, level: Hashable | None = None) -> Self: ...
429428
def drop_duplicates(self, *, keep: DropKeep = ...) -> Self: ...
@@ -489,7 +488,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
489488
) -> Index: ...
490489
@property
491490
def values(self) -> np_1darray: ...
492-
def memory_usage(self, deep: bool = False): ...
491+
def memory_usage(self, deep: bool = False) -> int: ...
493492
@overload
494493
def where(
495494
self,
@@ -503,8 +502,6 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
503502
other: Scalar | AnyArrayLike | None = None,
504503
) -> Index: ...
505504
def __contains__(self, key: Hashable) -> bool: ...
506-
@final
507-
def __setitem__(self, key, value) -> None: ...
508505
@overload
509506
def __getitem__(
510507
self,
@@ -519,9 +516,9 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
519516
@overload
520517
def append(self, other: Index | Sequence[Index]) -> Index: ...
521518
def putmask(self, mask, value): ...
522-
def equals(self, other: object) -> bool: ...
519+
def equals(self, other: Any) -> bool: ...
523520
@final
524-
def identical(self, other) -> bool: ...
521+
def identical(self, other: Any) -> bool: ...
525522
@final
526523
def asof(self, label): ...
527524
def asof_locs(self, where, mask): ...

pandas-stubs/core/indexes/multi.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class MultiIndex(Index):
109109
def is_monotonic_decreasing(self) -> bool: ...
110110
def duplicated(self, keep: DropKeep = "first"): ...
111111
def dropna(self, how: AnyAll = "any") -> Self: ...
112+
def droplevel(self, level: Level | Sequence[Level] = 0) -> MultiIndex | Index: ...
112113
def get_level_values(self, level: str | int) -> Index: ...
113114
def unique(self, level=...): ...
114115
def to_frame( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]

0 commit comments

Comments
 (0)