You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jacek Pliszka (Jira)" <ji...@apache.org> on 2022/10/23 18:19:00 UTC

[jira] [Comment Edited] (ARROW-14608) [Python] Provide access to hash_aggregate functions through a group_by method

    [ https://issues.apache.org/jira/browse/ARROW-14608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17622856#comment-17622856 ] 

Jacek Pliszka edited comment on ARROW-14608 at 10/23/22 6:18 PM:
-----------------------------------------------------------------

I think it should be relatively easy to do something like this:

 
{code:python}
t.group_by(['keys', 'values']).aggregate()
{code}

I did some naive benchmarks and looks like it should be 30% faster than converting to pandas and deduplicating. This was my naive test:

{code:python}

 t.append_column('i', pa.array([1]*len(t),pa.int64())).group_by(['keys', 'values']).aggregate([("i", "max")]).drop(['i_max'])

{code}

actual aggregation without i should be  even faster still will allow drop_duplicates functionality until better implementation arrives


was (Author: jacek.pliszka):
I think it should be relatively easy to do something like this:

 

`  t{color:#000000}.group_by([{color}{color:#a31515}'keys'{color}{color:#000000}, {color}{color:#a31515}'values'{color}{color:#000000}]).aggregate(){color}

 

{color:#000000}I did some naive benchmarks and looks like it should be 30% faster than converting to pandas and deduplicating. This was my naive test:{color}

 

{color:#000000}` {color}{color:#000000}t.append_column({color}{color:#a31515}'i'{color}{color:#000000}, pa.array([{color}{color:#098658}1{color}{color:#000000}]*{color}{color:#795e26}len{color}{color:#000000}(t),pa.int64())).group_by([{color}{color:#a31515}'keys'{color}{color:#000000}, {color}{color:#a31515}'values'{color}{color:#000000}]).aggregate([({color}{color:#a31515}"i"{color}{color:#000000}, {color}{color:#a31515}"max"{color}{color:#000000})]).drop([{color}{color:#a31515}'i_max'{color}{color:#000000}]){color}

 

{color:#000000}actuall aggregation without i should be  even faster still will allow drop_duplicates functionality until better implementation arrives{color}

> [Python] Provide access to hash_aggregate functions through a group_by method
> -----------------------------------------------------------------------------
>
>                 Key: ARROW-14608
>                 URL: https://issues.apache.org/jira/browse/ARROW-14608
>             Project: Apache Arrow
>          Issue Type: Sub-task
>          Components: Python
>    Affects Versions: 6.0.0
>            Reporter: Alessandro Molina
>            Assignee: Alessandro Molina
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 7.0.0
>
>          Time Spent: 10h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)