Skip to content
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

feat: method missing in ibis/expr/types/arrays.py #10441

Open
1 task done
mercelino opened this issue Nov 5, 2024 · 0 comments
Open
1 task done

feat: method missing in ibis/expr/types/arrays.py #10441

mercelino opened this issue Nov 5, 2024 · 0 comments
Labels
feature Features or general enhancements

Comments

@mercelino
Copy link

mercelino commented Nov 5, 2024

Is your feature request related to a problem?

The method mode() does not exist in the file ibis/expr/types/arrays.py, so it's not possible to apply it on a columns of arrays.
Although the method does exists in DuckDB https://duckdb.org/docs/sql/functions/list#list_-rewrite-functions

What is the motivation behind your request?

No response

Describe the solution you'd like

if i have
i would be able to do table.column.mode()
Example:
t = ibis.memtable(
... {
... "id": range(3),
... "arr": [
... [1, 2, 3, 3],
... [1, 1, 2, 2, 3, 4],
... [1, 1, 2 ,3]
... ],
... }
... )

The mode can be multiple elements, because the most frequent value in the 2 list of the column is 1 or 2, so we can pass an arguments to define if we want the min or the max

t.arr.mode('max') would give an output column arr of [3, 2, 1]
t.arr.mode('min') would give an output column arr of [3, 1, 1]
t.arr.mode() can have by default 'min' or 'max', as you want

Another option entirely different would be for the output to be a column of arrays, and then i would follow it up with the mins() or maxs() method myself

What version of ibis are you running?

9.5.0

What backend(s) are you using, if any?

DuckDB

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mercelino mercelino added the feature Features or general enhancements label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
Status: backlog
Development

No branches or pull requests

1 participant