Skip to content

Commit e2d5da2

Browse files
committed
mypy, ty
1 parent 5dcb984 commit e2d5da2

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

pandas-stubs/_typing.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,9 +967,7 @@ ListLikeExceptSeriesAndStr: TypeAlias = (
967967
MutableSequence[Any] | np_1darray | tuple[Any, ...] | Index
968968
)
969969
ListLikeU: TypeAlias = Sequence[Any] | np_1darray | Series | Index
970-
ListLikeHashable: TypeAlias = (
971-
MutableSequence[HashableT] | np_1darray | tuple[HashableT, ...] | range
972-
)
970+
ListLikeHashable: TypeAlias = SequenceNotStr[HashableT] | np_1darray | range
973971

974972
class SupportsDType(Protocol[GenericT_co]):
975973
@property

pandas-stubs/core/frame.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
11741174
@overload
11751175
def sort_values(
11761176
self,
1177-
by: _str | Sequence[_str],
1177+
by: _str | SequenceNotStr[_str],
11781178
*,
11791179
axis: Axis = 0,
11801180
ascending: _bool | Sequence[_bool] = ...,
@@ -1187,7 +1187,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
11871187
@overload
11881188
def sort_values(
11891189
self,
1190-
by: _str | Sequence[_str],
1190+
by: _str | SequenceNotStr[_str],
11911191
*,
11921192
axis: Axis = 0,
11931193
ascending: _bool | Sequence[_bool] = ...,

pandas-stubs/core/reshape/pivot.pyi

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,13 @@ _Values: TypeAlias = SequenceNotStr[Any] | _ExtendedAnyArrayLike
6767
@overload
6868
def pivot_table(
6969
data: DataFrame,
70-
values: _PivotTableValuesTypes[Hashable] = None,
71-
index: _PivotTableIndexTypes[Hashable] = None,
72-
columns: _PivotTableColumnsTypes[Hashable] = None,
70+
values: _PivotTableValuesTypes[
71+
Hashable # ty: ignore[invalid-type-arguments]
72+
] = None,
73+
index: _PivotTableIndexTypes[Hashable] = None, # ty: ignore[invalid-type-arguments]
74+
columns: _PivotTableColumnsTypes[
75+
Hashable # ty: ignore[invalid-type-arguments]
76+
] = None,
7377
aggfunc: (
7478
_PivotAggFunc[Any]
7579
| Sequence[_PivotAggFunc[Any]]
@@ -87,10 +91,16 @@ def pivot_table(
8791
@overload
8892
def pivot_table(
8993
data: DataFrame,
90-
values: _PivotTableValuesTypes[Hashable] = None,
94+
values: _PivotTableValuesTypes[
95+
Hashable # ty: ignore[invalid-type-arguments]
96+
] = None,
9197
*,
9298
index: Grouper,
93-
columns: _PivotTableColumnsTypes[Hashable] | np_ndarray | Index[Any] = None,
99+
columns: (
100+
_PivotTableColumnsTypes[Hashable] # ty: ignore[invalid-type-arguments]
101+
| np_ndarray
102+
| Index[Any]
103+
) = None,
94104
aggfunc: (
95105
_PivotAggFunc[Any]
96106
| Sequence[_PivotAggFunc[Any]]
@@ -106,8 +116,14 @@ def pivot_table(
106116
@overload
107117
def pivot_table(
108118
data: DataFrame,
109-
values: _PivotTableValuesTypes[Hashable] = None,
110-
index: _PivotTableIndexTypes[Hashable] | np_ndarray | Index[Any] = None,
119+
values: _PivotTableValuesTypes[
120+
Hashable # ty: ignore[invalid-type-arguments]
121+
] = None,
122+
index: (
123+
_PivotTableIndexTypes[Hashable] # ty: ignore[invalid-type-arguments]
124+
| np_ndarray
125+
| Index[Any]
126+
) = None,
111127
*,
112128
columns: Grouper,
113129
aggfunc: (

0 commit comments

Comments
 (0)