Custom Group By Functions
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the documented dt.count() grouped by('id') example in the issue and review the related quantiles request in issue #3165. Clarify how f.my_col is passed to custom functions such as np.percentile and whether grouped custom functions are supported; done means the expected grouped percentile behavior and supported function requirements are documented or implemented.
Written by the indexing model from the issue text.
Description
Following the documentation, you can get the count per group using:
x[:, { 'count': dt.count() }, by('id') ]
When trying to also include the percentile of a column by group, the np.percentile() function does not work
x[:, { 'count': dt.count(), 'percentile': np.percentile(f.my_col, 1) }, by('id') ]
How does the by operator handle the f.my_col selector? In R's data.table , you can basically apply any function that takes a vector as an input. so using np.percentile on the f.my_col would work. and the resulting table would be something like:
| id | count | percentile |
|---|---|---|
| 0 | 10 | 5 |
| 1 | 30 | 10 |
| .... | .... | .... |
i've seen this issue which has a similar request for quantiles: https://github.com/h2oai/datatable/issues/3165
How would I apply a custom function ( or one like np.percentile()) to the subset, or a column subset in the by?
do all functions need to be made "group-aware" to use by?
Does this make any custom-function by group impossible to do? Thanks!
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from h2oai/datatable
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Similar issues
-
comp-s3queue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ClickHouse/ClickHouse#137649 ·
Maintainers usually reply within 1 day
-
Clear params.inputs in dials.indexPossibly taken @phyy-nx claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dials/dials#3361 · 1 comment ·
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 71/100
facebookexperimental/semcode#195 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100