Skip to content
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

An option to run once for pandas.DataFrame.apply #16946

Closed
zygmuntz opened this issue Jul 15, 2017 · 2 comments
Closed

An option to run once for pandas.DataFrame.apply #16946

zygmuntz opened this issue Jul 15, 2017 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@zygmuntz
Copy link

In the current implementation apply calls func twice on the first column/row to decide whether it can take a fast or slow code path. This can lead to unexpected behavior if func has side-effects, as they will take effect twice for the first column/row.

In my opinion apply() should have an option to disable this check. Sometimes for functions with side effects, consistent behaviour is more important that speed.

@TomAugspurger
Copy link
Contributor

Are you able to use .pipe rather than apply for your use-case?

@jreback
Copy link
Contributor

jreback commented Jul 15, 2017

this is a dupe of #2936

this can simply be fixed. To compute starting at the next row.

@jreback jreback closed this as completed Jul 15, 2017
@jreback jreback added Duplicate Report Duplicate issue or pull request Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Jul 15, 2017
@jreback jreback added this to the No action milestone Jul 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Groupby Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

3 participants