@@ -12,7 +12,7 @@ class providing the base-class of operations.
12
12
import datetime
13
13
from functools import partial , wraps
14
14
import types
15
- from typing import Optional , Type
15
+ from typing import Optional , Tuple , Type
16
16
import warnings
17
17
18
18
import numpy as np
@@ -1041,17 +1041,15 @@ def _bool_agg(self, val_test, skipna):
1041
1041
Shared func to call any / all Cython GroupBy implementations.
1042
1042
"""
1043
1043
1044
- def objs_to_bool (vals ):
1045
- # type: (np.ndarray) -> (np.ndarray, Type)
1044
+ def objs_to_bool (vals : np .ndarray ) -> Tuple [np .ndarray , Type ]:
1046
1045
if is_object_dtype (vals ):
1047
1046
vals = np .array ([bool (x ) for x in vals ])
1048
1047
else :
1049
1048
vals = vals .astype (np .bool )
1050
1049
1051
1050
return vals .view (np .uint8 ), np .bool
1052
1051
1053
- def result_to_bool (result , inference ):
1054
- # type: (np.ndarray, Type) -> np.ndarray
1052
+ def result_to_bool (result : np .ndarray , inference : Type ) -> np .ndarray :
1055
1053
return result .astype (inference , copy = False )
1056
1054
1057
1055
return self ._get_cythonized_result ('group_any_all' , self .grouper ,
@@ -1739,8 +1737,9 @@ def quantile(self, q=0.5, interpolation='linear'):
1739
1737
b 3.0
1740
1738
"""
1741
1739
1742
- def pre_processor (vals ):
1743
- # type: (np.ndarray) -> (np.ndarray, Optional[Type])
1740
+ def pre_processor (
1741
+ vals : np .ndarray
1742
+ ) -> Tuple [np .ndarray , Optional [Type ]]:
1744
1743
if is_object_dtype (vals ):
1745
1744
raise TypeError ("'quantile' cannot be performed against "
1746
1745
"'object' dtypes!" )
@@ -1754,8 +1753,10 @@ def pre_processor(vals):
1754
1753
1755
1754
return vals , inference
1756
1755
1757
- def post_processor (vals , inference ):
1758
- # type: (np.ndarray, Optional[Type]) -> np.ndarray
1756
+ def post_processor (
1757
+ vals : np .ndarray ,
1758
+ inference : Optional [Type ]
1759
+ ) -> np .ndarray :
1759
1760
if inference :
1760
1761
# Check for edge case
1761
1762
if not (is_integer_dtype (inference ) and
0 commit comments