@@ -35,7 +35,7 @@ from pandas._typing import (
3535_PivotAggCallable : TypeAlias = Callable [[Series ], ScalarT ]
3636
3737_PivotAggFunc : TypeAlias = (
38- _PivotAggCallable
38+ _PivotAggCallable [ ScalarT ]
3939 | np .ufunc
4040 | Literal ["mean" , "sum" , "count" , "min" , "max" , "median" , "std" , "var" ]
4141)
@@ -67,11 +67,17 @@ _Values: TypeAlias = SequenceNotStr[Any] | _ExtendedAnyArrayLike
6767@overload
6868def pivot_table (
6969 data : DataFrame ,
70- values : _PivotTableValuesTypes = None ,
71- index : _PivotTableIndexTypes = None ,
72- columns : _PivotTableColumnsTypes = 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 : (
74- _PivotAggFunc | Sequence [_PivotAggFunc ] | Mapping [Hashable , _PivotAggFunc ]
78+ _PivotAggFunc [Scalar ]
79+ | Sequence [_PivotAggFunc [Scalar ]]
80+ | Mapping [Hashable , _PivotAggFunc [Scalar ]]
7581 ) = "mean" ,
7682 fill_value : Scalar | None = None ,
7783 margins : bool = False ,
@@ -85,12 +91,20 @@ def pivot_table(
8591@overload
8692def pivot_table (
8793 data : DataFrame ,
88- values : _PivotTableValuesTypes = None ,
94+ values : _PivotTableValuesTypes [
95+ Hashable # ty: ignore[invalid-type-arguments]
96+ ] = None ,
8997 * ,
9098 index : Grouper ,
91- columns : _PivotTableColumnsTypes | np_ndarray | Index [Any ] = None ,
99+ columns : (
100+ _PivotTableColumnsTypes [Hashable ] # ty: ignore[invalid-type-arguments]
101+ | np_ndarray
102+ | Index [Any ]
103+ ) = None ,
92104 aggfunc : (
93- _PivotAggFunc | Sequence [_PivotAggFunc ] | Mapping [Hashable , _PivotAggFunc ]
105+ _PivotAggFunc [Scalar ]
106+ | Sequence [_PivotAggFunc [Scalar ]]
107+ | Mapping [Hashable , _PivotAggFunc [Scalar ]]
94108 ) = "mean" ,
95109 fill_value : Scalar | None = None ,
96110 margins : bool = False ,
@@ -102,12 +116,20 @@ def pivot_table(
102116@overload
103117def pivot_table (
104118 data : DataFrame ,
105- values : _PivotTableValuesTypes = None ,
106- index : _PivotTableIndexTypes | 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 ,
107127 * ,
108128 columns : Grouper ,
109129 aggfunc : (
110- _PivotAggFunc | Sequence [_PivotAggFunc ] | Mapping [Hashable , _PivotAggFunc ]
130+ _PivotAggFunc [Scalar ]
131+ | Sequence [_PivotAggFunc [Scalar ]]
132+ | Mapping [Hashable , _PivotAggFunc [Scalar ]]
111133 ) = "mean" ,
112134 fill_value : Scalar | None = None ,
113135 margins : bool = False ,
0 commit comments