Skip to content

Commit 35aef78

Browse files
committed
mypy, ty
1 parent 3aa71cb commit 35aef78

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 | 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
@@ -66,9 +66,13 @@ _ExtendedAnyArrayLike: TypeAlias = AnyArrayLike | ArrayLike
6666
@overload
6767
def pivot_table(
6868
data: DataFrame,
69-
values: _PivotTableValuesTypes[Hashable] = None,
70-
index: _PivotTableIndexTypes[Hashable] = None,
71-
columns: _PivotTableColumnsTypes[Hashable] = None,
69+
values: _PivotTableValuesTypes[
70+
Hashable # ty: ignore[invalid-type-arguments]
71+
] = None,
72+
index: _PivotTableIndexTypes[Hashable] = None, # ty: ignore[invalid-type-arguments]
73+
columns: _PivotTableColumnsTypes[
74+
Hashable # ty: ignore[invalid-type-arguments]
75+
] = None,
7276
aggfunc: (
7377
_PivotAggFunc[Any]
7478
| Sequence[_PivotAggFunc[Any]]
@@ -86,10 +90,16 @@ def pivot_table(
8690
@overload
8791
def pivot_table(
8892
data: DataFrame,
89-
values: _PivotTableValuesTypes[Hashable] = None,
93+
values: _PivotTableValuesTypes[
94+
Hashable # ty: ignore[invalid-type-arguments]
95+
] = None,
9096
*,
9197
index: Grouper,
92-
columns: _PivotTableColumnsTypes[Hashable] | np_ndarray | Index[Any] = None,
98+
columns: (
99+
_PivotTableColumnsTypes[Hashable] # ty: ignore[invalid-type-arguments]
100+
| np_ndarray
101+
| Index[Any]
102+
) = None,
93103
aggfunc: (
94104
_PivotAggFunc[Any]
95105
| Sequence[_PivotAggFunc[Any]]
@@ -105,8 +115,14 @@ def pivot_table(
105115
@overload
106116
def pivot_table(
107117
data: DataFrame,
108-
values: _PivotTableValuesTypes[Hashable] = None,
109-
index: _PivotTableIndexTypes[Hashable] | np_ndarray | Index[Any] = None,
118+
values: _PivotTableValuesTypes[
119+
Hashable # ty: ignore[invalid-type-arguments]
120+
] = None,
121+
index: (
122+
_PivotTableIndexTypes[Hashable] # ty: ignore[invalid-type-arguments]
123+
| np_ndarray
124+
| Index[Any]
125+
) = None,
110126
*,
111127
columns: Grouper,
112128
aggfunc: (

0 commit comments

Comments
 (0)