Skip to content
2 changes: 1 addition & 1 deletion pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
@property
def nlevels(self) -> int: ...
def get_level_values(self, level: int | _str) -> Index: ...
def droplevel(self, level: Level | Sequence[Level] = 0) -> Self: ...
@property
def is_monotonic_increasing(self) -> bool: ...
@property
Expand All @@ -452,6 +451,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
def dropna(self, how: AnyAll = "any") -> Self: ...
def unique(self, level: Hashable | None = None) -> Self: ...
def drop_duplicates(self, *, keep: DropKeep = "first") -> Self: ...
def droplevel(self, level: Sequence[Never] = ...) -> Self: ...
Comment thread
tinezivic marked this conversation as resolved.
Outdated
def duplicated(self, keep: DropKeep = "first") -> np_1darray_bool: ...
def __and__(self, other: Never) -> Never: ...
def __rand__(self, other: Never) -> Never: ...
Expand Down
4 changes: 4 additions & 0 deletions tests/indexes/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,10 @@ def test_index_droplevel() -> None:
check(assert_type(mi.droplevel(["elk"]), pd.MultiIndex | pd.Index), pd.Index)
check(assert_type(mi.droplevel(("elk",)), pd.MultiIndex | pd.Index), pd.Index)
check(assert_type(mi.droplevel(0), pd.MultiIndex | pd.Index), pd.Index)
if TYPE_CHECKING_INVALID_USAGE:
idx.droplevel(0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
Comment thread
tinezivic marked this conversation as resolved.
idx.droplevel([0]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
idx.droplevel("name") # type: ignore[arg-type] # pyright: ignore[reportArgumentType]


def test_index_setitem() -> None:
Expand Down
Loading