-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Dont do selection by callable if not wanted #13558
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
Comments
Thanks for the report. |
@sinhrks I don't think this is solved by that. The PR was to not execute the values that are stored (RHS, so to store callables in the dataframe), while here it is the key that should not be executed. I don't think there is any solution for this. Pandas will never know whether a callable inside |
Ah correct. I think options are:
Though using |
I guess option 1 is fine or just close as non supported this is abuse of pandas by passing in callables that behave differently with args or not - very odd, and not idiomatic nor pythonic honestly just close and user beware (unless it's a trivial fix) |
@jreback it's true, added option 3 (not support) |
I would pick the "not support" option 3. Adding complex logic to attempt to fall back gracefully here would be un-Pythonic. |
I would also vote to not do any additional work in pandas to support this. |
Copy-pastable Code Sample
Expected Output
How I fixed the test for the moment
If pandas invokes a callable object it passes the frame itself as a parameter. Because i dont need arguments for my call function i can prevent this call by checking if a argument is passed. Is there a better way of doing this or can you add an option so i can disable the new behavior.
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: