-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Experimental Higher Order Methods API #45557
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
Might wait until Monday to take a look. Troubleshooting azure left me cranky. |
@jreback @jbrockmendel friendly ping. |
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.
really just a minor comment.
result = getattr(self.obj, method)(a) | ||
except (TypeError, DataError): | ||
warnings.warn( | ||
f"{name} did not aggregate successfully. If any error is " |
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.
why do we want to warn here? (e.g. new api can we just raise)
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.
Right - new API will just raise. Starting out, I'd like to maintain as much consistency between api.use_hom=True
and api.use_hom=False
as possible, only making changes that would be hard/impossible to properly deprecate. Since this is already deprecated and will be changed in 2.0, I don't see a need to do it here.
doc/source/user_guide/homs_api.rst
Outdated
|
||
pandas is experimenting with improving the behavior of higher order methods (HOMs). These | ||
are methods that take a function as an argument, often a user-defined function (UDF). | ||
They include ``.apply``, ``.agg``, ``.transform``, and ``.filter``. The goal is to make |
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.
certainly could be done in followups
- link to the doc-strings for these methods
- in the doc-strings show the behavior changes when
use_hom
is enabled.
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.
Will link to doc strings here; going to hold off modifying the public doc-strings until this is ready.
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.
Done. I only listed methods that are currently being modified when using api.use_hom=True
. Will expand the list as modifications occur.
|
||
if not self.as_index: | ||
self._insert_inaxis_grouper_inplace(result) | ||
result.index = Index(range(len(result))) |
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.
some of this looks familiar. is it as de-duplicated as it can reasonably get?
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.
Perhaps not, but will be changed when implementing "agg always aggs" (#35725). In other words, duplicating further will likely have to be undone in the future.
Start of #41112, second attempt at #43736.
Built docs can be viewed in #43736 (wording slightly changed from there, but results are the same). If we go forward with this approach, needs to run on the CI with failures allowed.
cc @jbrockmendel