13
13
import collections
14
14
from collections import abc
15
15
import datetime
16
+ import functools
16
17
from io import StringIO
17
18
import itertools
18
19
import mmap
@@ -3045,7 +3046,6 @@ def _ixs(self, i: int, axis: int = 0):
3045
3046
3046
3047
# this is a cached value, mark it so
3047
3048
result ._set_as_cached (label , self )
3048
-
3049
3049
return result
3050
3050
3051
3051
def _get_column_array (self , i : int ) -> ArrayLike :
@@ -7934,7 +7934,7 @@ def apply(
7934
7934
return op .apply ()
7935
7935
7936
7936
def applymap (
7937
- self , func : PythonFuncType , na_action : Optional [str ] = None
7937
+ self , func : PythonFuncType , na_action : Optional [str ] = None , ** kwargs
7938
7938
) -> DataFrame :
7939
7939
"""
7940
7940
Apply a function to a Dataframe elementwise.
@@ -7948,6 +7948,9 @@ def applymap(
7948
7948
Python function, returns a single value from a single value.
7949
7949
na_action : {None, 'ignore'}, default None
7950
7950
If ‘ignore’, propagate NaN values, without passing them to func.
7951
+ **kwargs
7952
+ Additional keyword arguments to pass as keywords arguments to
7953
+ `func`.
7951
7954
7952
7955
.. versionadded:: 1.2
7953
7956
@@ -8002,6 +8005,7 @@ def applymap(
8002
8005
f"na_action must be 'ignore' or None. Got { repr (na_action )} "
8003
8006
)
8004
8007
ignore_na = na_action == "ignore"
8008
+ func = functools .partial (func , ** kwargs )
8005
8009
8006
8010
# if we have a dtype == 'M8[ns]', provide boxed values
8007
8011
def infer (x ):
0 commit comments