5
5
6
6
from collections import defaultdict
7
7
from functools import partial
8
- from typing import Any , DefaultDict , List , Sequence , Tuple
8
+ from typing import TYPE_CHECKING , Any , DefaultDict , Hashable , List , Sequence , Tuple
9
9
10
10
from pandas .core .dtypes .common import is_dict_like , is_list_like
11
11
12
12
import pandas .core .common as com
13
13
from pandas .core .indexes .api import Index
14
14
15
+ if TYPE_CHECKING :
16
+ import numpy as np
17
+
15
18
16
19
def is_multi_agg_with_relabel (** kwargs ) -> bool :
17
20
"""
@@ -39,7 +42,9 @@ def is_multi_agg_with_relabel(**kwargs) -> bool:
39
42
)
40
43
41
44
42
- def normalize_keyword_aggregation (kwargs : dict ) -> Tuple [dict , List [str ], List [int ]]:
45
+ def normalize_keyword_aggregation (
46
+ kwargs : dict ,
47
+ ) -> Tuple [DefaultDict , Tuple [Hashable ], "np.ndarray" ]:
43
48
"""
44
49
Normalize user-provided "named aggregation" kwargs.
45
50
Transforms from the new ``Mapping[str, NamedAgg]`` style kwargs
@@ -51,11 +56,11 @@ def normalize_keyword_aggregation(kwargs: dict) -> Tuple[dict, List[str], List[i
51
56
52
57
Returns
53
58
-------
54
- aggspec : dict
59
+ aggspec : DefaultDict[list]
55
60
The transformed kwargs.
56
- columns : List[str ]
61
+ columns : Tuple[Hashable ]
57
62
The user-provided keys.
58
- col_idx_order : List[int]
63
+ col_idx_order : numpy.ndarray
59
64
List of columns indices.
60
65
61
66
Examples
0 commit comments