Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Sep 17, 2023
1 parent 5276b11 commit 9d1ac2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/pandas/pdeps/0013-standardize-apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ It can also be noted that `Series.apply` & `DataFrame.apply` could almost always
| lambda x: str(x) | .map | .map |
| lambda x: x + 1 | .transform | .transform |
| [lambda x: x.sum()] | .agg | .agg |
``

Because of their flexibility, `Series.apply` & `DataFrame.apply` are considered unnecessarily complex, and it would be better to direct users to use `.map`, `.agg` or `.transform`, as appropriate in the given situation.
So, for example, `ser.apply(lambda x: str(x))` can be replaced with `ser.map(lambda x: str(x))` while `df.apply([lambda x: x.sum()])` can be replaced with `df.agg([lambda x: x.sum()])`.

Overall, because of their flexibility, `Series.apply` & `DataFrame.apply` are considered unnecessarily complex, and it would be clearer for users to use `.map`, `.agg` or `.transform`, as appropriate in the given situation.

## Proposal

Expand Down

0 comments on commit 9d1ac2f

Please sign in to comment.