-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
WIP/ENH: Weightby #15031
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
WIP/ENH: Weightby #15031
Conversation
function application that mimics the groupby(..).agg/.aggregate interface .apply is now a synonym for .agg, and will accept dict/list-likes for aggregations CLN: rename .name attr -> ._selection_name from SeriesGroupby for compat (didn't exist on DataFrameGroupBy) resolves conflicts w.r.t. setting .name on a groupby object closes pandas-dev#1623 closes pandas-dev#14464 custom .describe closes pandas-dev#14483 closes pandas-dev#15015 closes pandas-dev#7014
closes pandas-dev#10030
cc @josef-pkt |
Current coverage is 84.82% (diff: 94.75%)@@ master #15031 diff @@
==========================================
Files 145 146 +1
Lines 51131 51343 +212
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43346 43552 +206
- Misses 7785 7791 +6
Partials 0 0
|
This is quite straightforward to change to an API like the following (in fact the actual implementation already is like this, but I pass a hidden kwargs
I would rip out the weight validation code and put it else where (as a function). The only downside of this it would be awkward to then specify different kinds of weights (like the link in the top section), because we could then need to add other kwargs like |
Could you alleviate the different |
@mattayes yes that might be one way of doing it. |
closing in favor of #15039 |
closes #10030
this is on top of #14483
provides a groupby-like API to weighted calculations. The weights are lazily calculated and cached.
Deprecates the
weights
parameter to.sample()
, and implements all of this logic inside.weightby
.TODO:
.groupby(...).weightby(...)
or.groupby(...).rolling(...)
, but should be a straightforward enhancement..weightby
constructor), see here