Skip to content

Commit 75d2750

Browse files
authored
DOC: Add example for df.map without lambda (#56363)
DOC: add example for map without lambda
1 parent a164271 commit 75d2750

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/core/frame.py

+8
Original file line numberDiff line numberDiff line change
@@ -10339,6 +10339,14 @@ def map(
1033910339
0 NaN 4
1034010340
1 5.0 5
1034110341
10342+
It is also possible to use `map` with functions that are not
10343+
`lambda` functions:
10344+
10345+
>>> df.map(round, ndigits=1)
10346+
0 1
10347+
0 1.0 2.1
10348+
1 3.4 4.6
10349+
1034210350
Note that a vectorized version of `func` often exists, which will
1034310351
be much faster. You could square each number elementwise.
1034410352

0 commit comments

Comments
 (0)