Skip to content

Commit 815c8f9

Browse files
committed
fix code_checks.sh
1 parent ea3dfd8 commit 815c8f9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pandas/core/frame.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -9854,7 +9854,7 @@ def map(
98549854
98559855
>>> df_copy = df.copy()
98569856
>>> df_copy.iloc[0, 0] = pd.NA
9857-
>>> df_copy.applymap(lambda x: len(str(x)), na_action='ignore')
9857+
>>> df_copy.map(lambda x: len(str(x)), na_action='ignore')
98589858
0 1
98599859
0 NaN 4
98609860
1 5.0 5
@@ -9867,7 +9867,7 @@ def map(
98679867
0 1.000000 4.494400
98689868
1 11.262736 20.857489
98699869
9870-
But it's better to avoid applymap in that case.
9870+
But it's better to avoid map in that case.
98719871
98729872
>>> df ** 2
98739873
0 1
@@ -9887,7 +9887,7 @@ def map(
98879887
def infer(x):
98889888
return x._map_values(func, na_action=na_action)
98899889

9890-
return self.apply(infer).__finalize__(self, "applymap")
9890+
return self.apply(infer).__finalize__(self, "map")
98919891

98929892
def applymap(
98939893
self, func: PythonFuncType, na_action: str | None = None, **kwargs
@@ -9922,6 +9922,19 @@ def applymap(
99229922
DataFrame.apply : Apply a function along input axis of DataFrame.
99239923
DataFrame.map : Apply a function along input axis of DataFrame.
99249924
DataFrame.replace: Replace values given in `to_replace` with `value`.
9925+
9926+
Examples
9927+
--------
9928+
>>> df = pd.DataFrame([[1, 2.12], [3.356, 4.567]])
9929+
>>> df
9930+
0 1
9931+
0 1.000 2.120
9932+
1 3.356 4.567
9933+
9934+
>>> df.map(lambda x: len(str(x)))
9935+
0 1
9936+
0 3 4
9937+
1 5 5
99259938
"""
99269939
warnings.warn(
99279940
"DataFrame.applymap has been deprecated. Use DataFrame.map instead.",

0 commit comments

Comments
 (0)