Skip to content

Commit 4a41f52

Browse files
committed
fix code_checks.sh
1 parent 1495053 commit 4a41f52

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
@@ -9853,7 +9853,7 @@ def map(
98539853
98549854
>>> df_copy = df.copy()
98559855
>>> df_copy.iloc[0, 0] = pd.NA
9856-
>>> df_copy.applymap(lambda x: len(str(x)), na_action='ignore')
9856+
>>> df_copy.map(lambda x: len(str(x)), na_action='ignore')
98579857
0 1
98589858
0 NaN 4
98599859
1 5.0 5
@@ -9866,7 +9866,7 @@ def map(
98669866
0 1.000000 4.494400
98679867
1 11.262736 20.857489
98689868
9869-
But it's better to avoid applymap in that case.
9869+
But it's better to avoid map in that case.
98709870
98719871
>>> df ** 2
98729872
0 1
@@ -9886,7 +9886,7 @@ def map(
98869886
def infer(x):
98879887
return x._map_values(func, na_action=na_action)
98889888

9889-
return self.apply(infer).__finalize__(self, "applymap")
9889+
return self.apply(infer).__finalize__(self, "map")
98909890

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

0 commit comments

Comments
 (0)