Skip to content

TYP: Fix typing issues, mainly Something => IndexLabel #53469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6956,7 +6956,7 @@ def sort_index(

def value_counts(
self,
subset: Sequence[Hashable] | None = None,
subset: IndexLabel | None = None,
normalize: bool = False,
sort: bool = True,
ascending: bool = False,
Expand Down Expand Up @@ -7080,8 +7080,8 @@ def value_counts(
if normalize:
counts /= counts.sum()

# Force MultiIndex for single column
if is_list_like(subset) and len(subset) == 1:
# Force MultiIndex for a list_like subset with a single column
if is_list_like(subset) and len(subset) == 1: # type: ignore[arg-type]
counts.index = MultiIndex.from_arrays(
[counts.index], names=[counts.index.name]
)
Expand Down Expand Up @@ -8991,7 +8991,7 @@ def pivot_table(
sort=sort,
)

def stack(self, level: Level = -1, dropna: bool = True, sort: bool = True):
def stack(self, level: IndexLabel = -1, dropna: bool = True, sort: bool = True):
"""
Stack the prescribed level(s) from columns to index.

Expand Down Expand Up @@ -9296,7 +9296,7 @@ def explode(

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

def unstack(self, level: Level = -1, fill_value=None, sort: bool = True):
def unstack(self, level: IndexLabel = -1, fill_value=None, sort: bool = True):
"""
Pivot a level of the (necessarily hierarchical) index labels.

Expand Down