-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow arithmetic operations for list and array type #9188
Comments
While experimenting with the example I found it interesting you can add structs: a.list.to_struct() + b.list.to_struct()
# shape: (2,)
# Series: 'a' [struct[2]]
# [
# {5,7}
# {8,10}
# ] Although it only works with 2d, and requires turning back into a list. |
thanks for sharing @cmdlineluser ! I would not have guessed it would work with structs. |
Going to try to implement this. |
It was added for Array #16791 import polars as pl
import numpy as np
a = pl.Series("a",np.array([[1,2],[2,3]]))
b = pl.Series("b",np.array([[4,5],[6,7]]))
a + b
# shape: (2,)
# Series: 'a' [array[i64, 2]]
# [
# [5, 7]
# [8, 10]
# ] |
Thank you, that'll make it easier for me to implement given the example. |
OK, it appears to be working at least in the happy path. Remaining work:
|
@itamarst is it feasible to add pow support?
|
Problem description
I wish Polars could allows arithmetic operations for list and array types with an inner numeric data type.
Taking an example from this GitHub question: https://stackoverflow.com/questions/76389832/polars-how-to-add-two-series-that-contain-lists-as-elements
I would be nice to be able to do:
Currently, it panicks: PanicException:
add
operation not supported for dtypelist[i64]
The text was updated successfully, but these errors were encountered: