Skip to content

Commit 08d4425

Browse files
committed
fix code_checks.sh
1 parent 63d7663 commit 08d4425

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pandas/core/frame.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9827,7 +9827,7 @@ def map(
98279827
98289828
>>> df_copy = df.copy()
98299829
>>> df_copy.iloc[0, 0] = pd.NA
9830-
>>> df_copy.applymap(lambda x: len(str(x)), na_action='ignore')
9830+
>>> df_copy.map(lambda x: len(str(x)), na_action='ignore')
98319831
0 1
98329832
0 NaN 4
98339833
1 5.0 5
@@ -9840,7 +9840,7 @@ def map(
98409840
0 1.000000 4.494400
98419841
1 11.262736 20.857489
98429842
9843-
But it's better to avoid applymap in that case.
9843+
But it's better to avoid map in that case.
98449844
98459845
>>> df ** 2
98469846
0 1
@@ -9860,7 +9860,7 @@ def map(
98609860
def infer(x):
98619861
return x._map_values(func, na_action=na_action)
98629862

9863-
return self.apply(infer).__finalize__(self, "applymap")
9863+
return self.apply(infer).__finalize__(self, "map")
98649864

98659865
def applymap(
98669866
self, func: PythonFuncType, na_action: str | None = None, **kwargs
@@ -9895,6 +9895,19 @@ def applymap(
98959895
DataFrame.apply : Apply a function along input axis of DataFrame.
98969896
DataFrame.map : Apply a function along input axis of DataFrame.
98979897
DataFrame.replace: Replace values given in `to_replace` with `value`.
9898+
9899+
Examples
9900+
--------
9901+
>>> df = pd.DataFrame([[1, 2.12], [3.356, 4.567]])
9902+
>>> df
9903+
0 1
9904+
0 1.000 2.120
9905+
1 3.356 4.567
9906+
9907+
>>> df.map(lambda x: len(str(x)))
9908+
0 1
9909+
0 3 4
9910+
1 5 5
98989911
"""
98999912
warnings.warn(
99009913
"DataFrame.applymap has been deprecated. Use DataFrame.map instead.",

0 commit comments

Comments
 (0)