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

Let arr.reshape use Expr as inputs instead of just python tuple #17874

Open
deanm0000 opened this issue Jul 25, 2024 · 0 comments
Open

Let arr.reshape use Expr as inputs instead of just python tuple #17874

deanm0000 opened this issue Jul 25, 2024 · 0 comments
Labels
enhancement New feature or an improvement of an existing feature

Comments

@deanm0000
Copy link
Collaborator

Description

Suppose I have

zz=pl.DataFrame({'a':
    [[1,2],[2,3],[3,4]]}, schema={'a':pl.Array(pl.Int8,2)}
    )

Let's say I want to add 3, I can do

zz.select((pl.col('a').explode()+3).reshape((3,2)))

or even

zz.select((pl.col('a').explode()+3).reshape((zz.shape[0],zz.schema['a'].shape[0])))

but it'd be nice if we could do

zz.select((pl.col('a').explode()+3).reshape(pl.len(),pl.col('a').arr.to_list().list.len()))

"nice" here is relative since we still have to turn it into a list to get its original width in an expression.

Note: I just used adding a scaler as a simple example, I know that that'll work natively soon.

@deanm0000 deanm0000 added the enhancement New feature or an improvement of an existing feature label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant