@@ -269,7 +269,7 @@ def item_from_zerodim(val: object) -> object:
269
269
270
270
@ cython.wraparound (False )
271
271
@ cython.boundscheck (False )
272
- def fast_unique_multiple (list arrays , sort: bool = True ):
272
+ def fast_unique_multiple (list arrays , sort: bool = True ) -> list :
273
273
"""
274
274
Generate a list of unique values from a list of arrays.
275
275
@@ -345,7 +345,7 @@ def fast_unique_multiple_list(lists: list, sort: bool = True) -> list:
345
345
346
346
@ cython.wraparound (False )
347
347
@ 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 :
349
349
"""
350
350
Generate a list of unique values from a generator of lists.
351
351
@@ -409,7 +409,7 @@ def dicts_to_array(dicts: list, columns: list):
409
409
return result
410
410
411
411
412
- def fast_zip (list ndarrays ):
412
+ def fast_zip (list ndarrays ) -> ndarray[object] :
413
413
"""
414
414
For zipping multiple ndarrays into an ndarray of tuples.
415
415
"""
@@ -621,7 +621,7 @@ def array_equivalent_object(left: object[:], right: object[:]) -> bool:
621
621
622
622
@ cython.wraparound (False )
623
623
@ cython.boundscheck (False )
624
- def astype_intsafe (ndarray[object] arr , new_dtype ):
624
+ def astype_intsafe (ndarray[object] arr , new_dtype ) -> ndarray :
625
625
cdef:
626
626
Py_ssize_t i , n = len (arr)
627
627
object val
@@ -891,7 +891,7 @@ def generate_slices(const int64_t[:] labels, Py_ssize_t ngroups):
891
891
892
892
893
893
def indices_fast (ndarray index , const int64_t[:] labels , list keys ,
894
- list sorted_labels ):
894
+ list sorted_labels ) -> dict :
895
895
"""
896
896
Parameters
897
897
----------
@@ -1979,8 +1979,12 @@ cpdef bint is_interval_array(ndarray values):
1979
1979
1980
1980
@ cython.boundscheck (False )
1981
1981
@ 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:
1984
1988
"""
1985
1989
Convert object array to a numeric array if possible.
1986
1990
@@ -2154,7 +2158,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values,
2154
2158
def maybe_convert_objects (ndarray[object] objects , bint try_float = False ,
2155
2159
bint safe = False , bint convert_datetime = False ,
2156
2160
bint convert_timedelta = False ,
2157
- bint convert_to_nullable_integer = False ):
2161
+ bint convert_to_nullable_integer = False ) -> "ArrayLike" :
2158
2162
"""
2159
2163
Type inference function-- convert object array to proper dtype
2160
2164
@@ -2181,6 +2185,7 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=False,
2181
2185
Returns
2182
2186
-------
2183
2187
np.ndarray or ExtensionArray
2188
+ Array of converted object values to more specific dtypes if applicable.
2184
2189
"""
2185
2190
cdef:
2186
2191
Py_ssize_t i , n
@@ -2408,13 +2413,13 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=False,
2408
2413
2409
2414
2410
2415
# 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.
2412
2417
2413
2418
2414
2419
@ cython.boundscheck (False )
2415
2420
@ cython.wraparound (False )
2416
2421
def 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" :
2418
2423
"""
2419
2424
Substitute for np.vectorize with pandas-friendly dtype inference.
2420
2425
@@ -2469,7 +2474,9 @@ def map_infer_mask(ndarray arr, object f, const uint8_t[:] mask, bint convert=Tr
2469
2474
2470
2475
@ cython.boundscheck (False )
2471
2476
@ 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":
2473
2480
"""
2474
2481
Substitute for np.vectorize with pandas-friendly dtype inference.
2475
2482
@@ -2483,7 +2490,7 @@ def map_infer(ndarray arr, object f, bint convert=True, bint ignore_na=False):
2483
2490
2484
2491
Returns
2485
2492
-------
2486
- ndarray
2493
+ np. ndarray or ExtensionArray
2487
2494
"""
2488
2495
cdef:
2489
2496
Py_ssize_t i , n
@@ -2513,7 +2520,7 @@ def map_infer(ndarray arr, object f, bint convert=True, bint ignore_na=False):
2513
2520
return result
2514
2521
2515
2522
2516
- def to_object_array (rows: object , int min_width = 0 ) :
2523
+ def to_object_array (rows: object , min_width: int = 0 ) -> ndarray :
2517
2524
"""
2518
2525
Convert a list of lists into an object array.
2519
2526
@@ -2529,7 +2536,7 @@ def to_object_array(rows: object, int min_width=0):
2529
2536
2530
2537
Returns
2531
2538
-------
2532
- numpy array of the object dtype.
2539
+ np.ndarray[ object , ndim = 2 ]
2533
2540
"""
2534
2541
cdef:
2535
2542
Py_ssize_t i , j , n , k , tmp
@@ -2621,7 +2628,7 @@ def to_object_array_tuples(rows: object):
2621
2628
2622
2629
@ cython.wraparound (False )
2623
2630
@ 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" :
2625
2632
cdef:
2626
2633
Py_ssize_t i , n = len (keys)
2627
2634
object val
0 commit comments