-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Updated documentation for pandas.DataFrame.map #54649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added an example for standard functions for the map function
Added documentation for extra keyword arguments in the map method
pandas/core/frame.py
Outdated
@@ -10088,6 +10088,20 @@ def map( | |||
0 3 4 | |||
1 5 5 | |||
|
|||
>>> def func(x,y): # x refers to the element in the DataFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just define a lambda that takes an extra argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually my goal was to demonstrate how the map function can be used with standard functions that are not lambdas. If you think I should use a more complex example to show that, I could do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just provide a built in function like round
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the advice! I did just that, you can have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looks like some code checks are failing in the CI
Used round function instead of defining a function in the example
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
closes issue #54648 by adding another example of the map method using a standard func, along with additional keyword arguments.