Skip to content

Commit 936b1aa

Browse files
committed
TYP: Fix typing issues, mainly Something => IndexLabel
1 parent a1f050a commit 936b1aa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/frame.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -6956,7 +6956,7 @@ def sort_index(
69566956

69576957
def value_counts(
69586958
self,
6959-
subset: Sequence[Hashable] | None = None,
6959+
subset: IndexLabel | None = None,
69606960
normalize: bool = False,
69616961
sort: bool = True,
69626962
ascending: bool = False,
@@ -7080,8 +7080,8 @@ def value_counts(
70807080
if normalize:
70817081
counts /= counts.sum()
70827082

7083-
# Force MultiIndex for single column
7084-
if is_list_like(subset) and len(subset) == 1:
7083+
# Force MultiIndex for a list_like subset with a single column
7084+
if is_list_like(subset) and len(list(subset)) == 1:
70857085
counts.index = MultiIndex.from_arrays(
70867086
[counts.index], names=[counts.index.name]
70877087
)
@@ -7375,7 +7375,7 @@ def swaplevel(self, i: Axis = -2, j: Axis = -1, axis: Axis = 0) -> DataFrame:
73757375
result.columns = result.columns.swaplevel(i, j)
73767376
return result
73777377

7378-
def reorder_levels(self, order: Sequence[int | str], axis: Axis = 0) -> DataFrame:
7378+
def reorder_levels(self, order: Sequence[Hashable], axis: Axis = 0) -> DataFrame:
73797379
"""
73807380
Rearrange index levels using input order. May not drop or duplicate levels.
73817381
@@ -8991,7 +8991,7 @@ def pivot_table(
89918991
sort=sort,
89928992
)
89938993

8994-
def stack(self, level: Level = -1, dropna: bool = True, sort: bool = True):
8994+
def stack(self, level: IndexLabel = -1, dropna: bool = True, sort: bool = True):
89958995
"""
89968996
Stack the prescribed level(s) from columns to index.
89978997
@@ -9296,7 +9296,7 @@ def explode(
92969296

92979297
return result.__finalize__(self, method="explode")
92989298

9299-
def unstack(self, level: Level = -1, fill_value=None):
9299+
def unstack(self, level: IndexLabel = -1, fill_value=None):
93009300
"""
93019301
Pivot a level of the (necessarily hierarchical) index labels.
93029302

0 commit comments

Comments
 (0)