@@ -12,7 +12,7 @@ class providing the base-class of operations.
1212import datetime
1313from functools import partial , wraps
1414import types
15- from typing import Optional , Type
15+ from typing import Optional , Tuple , Type
1616import warnings
1717
1818import numpy as np
@@ -1041,17 +1041,15 @@ def _bool_agg(self, val_test, skipna):
10411041 Shared func to call any / all Cython GroupBy implementations.
10421042 """
10431043
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 ]:
10461045 if is_object_dtype (vals ):
10471046 vals = np .array ([bool (x ) for x in vals ])
10481047 else :
10491048 vals = vals .astype (np .bool )
10501049
10511050 return vals .view (np .uint8 ), np .bool
10521051
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 :
10551053 return result .astype (inference , copy = False )
10561054
10571055 return self ._get_cythonized_result ('group_any_all' , self .grouper ,
@@ -1739,8 +1737,9 @@ def quantile(self, q=0.5, interpolation='linear'):
17391737 b 3.0
17401738 """
17411739
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 ]]:
17441743 if is_object_dtype (vals ):
17451744 raise TypeError ("'quantile' cannot be performed against "
17461745 "'object' dtypes!" )
@@ -1754,8 +1753,10 @@ def pre_processor(vals):
17541753
17551754 return vals , inference
17561755
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 :
17591760 if inference :
17601761 # Check for edge case
17611762 if not (is_integer_dtype (inference ) and
0 commit comments