Skip to content

Commit a7c8513

Browse files
authored
TYP: fix a few errors found by pandas-stub (#47562)
1 parent d05bdeb commit a7c8513

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

pandas/_testing/asserters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ def assert_series_equal(
864864
check_dtype: bool | Literal["equiv"] = True,
865865
check_index_type="equiv",
866866
check_series_type=True,
867-
check_less_precise=no_default,
867+
check_less_precise: bool | int | NoDefault = no_default,
868868
check_names=True,
869869
check_exact=False,
870870
check_datetimelike_compat=False,

pandas/core/generic.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,9 @@ def _rename(
10501050
return result.__finalize__(self, method="rename")
10511051

10521052
@rewrite_axis_style_signature("mapper", [("copy", True), ("inplace", False)])
1053-
def rename_axis(self, mapper=lib.no_default, **kwargs):
1053+
def rename_axis(
1054+
self, mapper: IndexLabel | lib.NoDefault = lib.no_default, **kwargs
1055+
):
10541056
"""
10551057
Set the name of the axis for the index or columns.
10561058

pandas/core/indexes/multi.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,10 @@ def from_tuples(
578578

579579
@classmethod
580580
def from_product(
581-
cls, iterables, sortorder=None, names=lib.no_default
581+
cls,
582+
iterables: Sequence[Iterable[Hashable]],
583+
sortorder: int | None = None,
584+
names: Sequence[Hashable] | lib.NoDefault = lib.no_default,
582585
) -> MultiIndex:
583586
"""
584587
Make a MultiIndex from the cartesian product of multiple iterables.

pandas/plotting/_matplotlib/groupby.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def reconstruct_data_with_by(
112112

113113
data_list = []
114114
for key, group in grouped:
115-
columns = MultiIndex.from_product([[key], cols])
115+
# error: List item 1 has incompatible type "Union[Hashable,
116+
# Sequence[Hashable]]"; expected "Iterable[Hashable]"
117+
columns = MultiIndex.from_product([[key], cols]) # type: ignore[list-item]
116118
sub_group = group[cols]
117119
sub_group.columns = columns
118120
data_list.append(sub_group)

0 commit comments

Comments
 (0)