Skip to content

QST: How to use 'numba' for group by sum #59445

@acmilannesta

Description

@acmilannesta

Research

  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.

Link to question on StackOverflow

https://stackoverflow.com/questions/78845935/qst-how-to-use-numba-for-group-by-sum

Question about pandas

import numba

@numba.njit
def sum_func(index, values):
    return pd.Series(np.sum(values), index=index)

df_long_control[['user_id', 'reward_type', 'reward']].groupby(['user_id', 'reward_type'], as_index=False).apply(sum_func, engine='numba')

I'm trying to group by user_id and reward_type and apply sum function using numba, but got an error

TypeError: sum_func() got an unexpected keyword argument 'engine'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssue that has not been reviewed by a pandas team memberUsage Question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions