@@ -269,7 +269,7 @@ def item_from_zerodim(val: object) -> object:
269269
270270@ cython.wraparound (False )
271271@ cython.boundscheck (False )
272- def fast_unique_multiple (list arrays , sort: bool = True ):
272+ def fast_unique_multiple (list arrays , sort: bool = True ) -> list :
273273 """
274274 Generate a list of unique values from a list of arrays.
275275
@@ -345,7 +345,7 @@ def fast_unique_multiple_list(lists: list, sort: bool = True) -> list:
345345
346346@ cython.wraparound (False )
347347@ cython.boundscheck (False )
348- def fast_unique_multiple_list_gen (object gen , bint sort = True ):
348+ def fast_unique_multiple_list_gen (object gen , bint sort = True ) -> list :
349349 """
350350 Generate a list of unique values from a generator of lists.
351351
@@ -409,7 +409,7 @@ def dicts_to_array(dicts: list, columns: list):
409409 return result
410410
411411
412- def fast_zip (list ndarrays ):
412+ def fast_zip (list ndarrays ) -> ndarray[object] :
413413 """
414414 For zipping multiple ndarrays into an ndarray of tuples.
415415 """
@@ -621,7 +621,7 @@ def array_equivalent_object(left: object[:], right: object[:]) -> bool:
621621
622622@ cython.wraparound (False )
623623@ cython.boundscheck (False )
624- def astype_intsafe (ndarray[object] arr , new_dtype ):
624+ def astype_intsafe (ndarray[object] arr , new_dtype ) -> ndarray :
625625 cdef:
626626 Py_ssize_t i , n = len (arr)
627627 object val
@@ -891,7 +891,7 @@ def generate_slices(const int64_t[:] labels, Py_ssize_t ngroups):
891891
892892
893893def indices_fast (ndarray index , const int64_t[:] labels , list keys ,
894- list sorted_labels ):
894+ list sorted_labels ) -> dict :
895895 """
896896 Parameters
897897 ----------
@@ -1979,8 +1979,12 @@ cpdef bint is_interval_array(ndarray values):
19791979
19801980@ cython.boundscheck (False )
19811981@ cython.wraparound (False )
1982- def maybe_convert_numeric (ndarray[object] values , set na_values ,
1983- bint convert_empty = True , bint coerce_numeric = False ):
1982+ def maybe_convert_numeric (
1983+ ndarray[object] values ,
1984+ set na_values ,
1985+ bint convert_empty = True ,
1986+ bint coerce_numeric = False ,
1987+ ) -> ndarray:
19841988 """
19851989 Convert object array to a numeric array if possible.
19861990
@@ -2154,7 +2158,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values,
21542158def maybe_convert_objects (ndarray[object] objects , bint try_float = False ,
21552159 bint safe = False , bint convert_datetime = False ,
21562160 bint convert_timedelta = False ,
2157- bint convert_to_nullable_integer = False ):
2161+ bint convert_to_nullable_integer = False ) -> "ArrayLike" :
21582162 """
21592163 Type inference function-- convert object array to proper dtype
21602164
@@ -2181,6 +2185,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=False,
21812185 Returns
21822186 -------
21832187 np.ndarray or ExtensionArray
2188+ Array of converted object values to more specific dtypes if applicable.
21842189 """
21852190 cdef:
21862191 Py_ssize_t i , n
@@ -2408,13 +2413,13 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=False,
24082413
24092414
24102415# Note: no_default is exported to the public API in pandas.api.extensions
2411- no_default = object () # : Sentinel indicating the default value.
2416+ no_default = object () # Sentinel indicating the default value.
24122417
24132418
24142419@ cython.boundscheck (False )
24152420@ cython.wraparound (False )
24162421def map_infer_mask (ndarray arr , object f , const uint8_t[:] mask , bint convert = True ,
2417- object na_value = no_default, object dtype = object ):
2422+ object na_value = no_default, object dtype = object ) -> "ArrayLike" :
24182423 """
24192424 Substitute for np.vectorize with pandas-friendly dtype inference.
24202425
@@ -2469,7 +2474,9 @@ def map_infer_mask(ndarray arr, object f, const uint8_t[:] mask, bint convert=Tr
24692474
24702475@ cython.boundscheck (False )
24712476@ cython.wraparound (False )
2472- def map_infer (ndarray arr , object f , bint convert = True , bint ignore_na = False ):
2477+ def map_infer (
2478+ ndarray arr , object f , bint convert = True , bint ignore_na = False
2479+ ) -> "ArrayLike":
24732480 """
24742481 Substitute for np.vectorize with pandas-friendly dtype inference.
24752482
@@ -2483,7 +2490,7 @@ def map_infer(ndarray arr, object f, bint convert=True, bint ignore_na=False):
24832490
24842491 Returns
24852492 -------
2486- ndarray
2493+ np. ndarray or ExtensionArray
24872494 """
24882495 cdef:
24892496 Py_ssize_t i , n
@@ -2513,7 +2520,7 @@ def map_infer(ndarray arr, object f, bint convert=True, bint ignore_na=False):
25132520 return result
25142521
25152522
2516- def to_object_array (rows: object , int min_width = 0 ) :
2523+ def to_object_array (rows: object , min_width: int = 0 ) -> ndarray :
25172524 """
25182525 Convert a list of lists into an object array.
25192526
@@ -2529,7 +2536,7 @@ def to_object_array(rows: object, int min_width=0):
25292536
25302537 Returns
25312538 -------
2532- numpy array of the object dtype.
2539+ np.ndarray[ object , ndim = 2 ]
25332540 """
25342541 cdef:
25352542 Py_ssize_t i , j , n , k , tmp
@@ -2621,7 +2628,7 @@ def to_object_array_tuples(rows: object):
26212628
26222629@ cython.wraparound (False )
26232630@ cython.boundscheck (False )
2624- def fast_multiget (dict mapping , ndarray keys , default = np.nan):
2631+ def fast_multiget (dict mapping , ndarray keys , default = np.nan) -> "ArrayLike" :
26252632 cdef:
26262633 Py_ssize_t i , n = len (keys)
26272634 object val
0 commit comments