@@ -865,7 +865,7 @@ def _reduce(
865
865
return func (skipna = skipna , ** kwds )
866
866
867
867
@final
868
- def _map_values (self , mapper , na_action = None ):
868
+ def _map_values (self , mapper , na_action = None , convert : bool = True ):
869
869
"""
870
870
An internal function that maps values using the input
871
871
correspondence (which can be a dict, Series, or function).
@@ -877,6 +877,10 @@ def _map_values(self, mapper, na_action=None):
877
877
na_action : {None, 'ignore'}
878
878
If 'ignore', propagate NA values, without passing them to the
879
879
mapping function
880
+ convert : bool, default True
881
+ Try to find better dtype for elementwise function results. If
882
+ False, leave as dtype=object. Note that the dtype is always
883
+ preserved for some extension array dtypes, such as Categorical.
880
884
881
885
Returns
882
886
-------
@@ -894,7 +898,7 @@ def _map_values(self, mapper, na_action=None):
894
898
# "Union[IndexOpsMixin, ExtensionArray, ndarray[Any, Any]]";
895
899
# expected "Union[ExtensionArray, ndarray[Any, Any]]"
896
900
return algorithms .map_array (
897
- arr , mapper , na_action = na_action # type: ignore[arg-type]
901
+ arr , mapper , na_action = na_action , convert = convert # type: ignore[arg-type]
898
902
)
899
903
900
904
@final
0 commit comments