Skip to content

TYP: fix a few errors found by pandas-stub #47562

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 5 commits into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pandas/_testing/asserters.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ def assert_series_equal(
check_dtype: bool | Literal["equiv"] = True,
check_index_type="equiv",
check_series_type=True,
check_less_precise=no_default,
check_less_precise: bool | int | NoDefault = no_default,
check_names=True,
check_exact=False,
check_datetimelike_compat=False,
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,9 @@ def _rename(
return result.__finalize__(self, method="rename")

@rewrite_axis_style_signature("mapper", [("copy", True), ("inplace", False)])
def rename_axis(self, mapper=lib.no_default, **kwargs):
def rename_axis(
self, mapper: IndexLabel | lib.NoDefault = lib.no_default, **kwargs
):
"""
Set the name of the axis for the index or columns.

Expand Down
5 changes: 4 additions & 1 deletion pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,10 @@ def from_tuples(

@classmethod
def from_product(
cls, iterables, sortorder=None, names=lib.no_default
cls,
iterables: Sequence[Iterable[Hashable]],
sortorder: int | None = None,
names: Sequence[Hashable] | lib.NoDefault = lib.no_default,
) -> MultiIndex:
"""
Make a MultiIndex from the cartesian product of multiple iterables.
Expand Down
4 changes: 3 additions & 1 deletion pandas/plotting/_matplotlib/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def reconstruct_data_with_by(

data_list = []
for key, group in grouped:
columns = MultiIndex.from_product([[key], cols])
# error: List item 1 has incompatible type "Union[Hashable,
# Sequence[Hashable]]"; expected "Iterable[Hashable]"
columns = MultiIndex.from_product([[key], cols]) # type: ignore[list-item]
sub_group = group[cols]
sub_group.columns = columns
data_list.append(sub_group)
Expand Down