-
Notifications
You must be signed in to change notification settings - Fork 125
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
add support for map as expression #855
Conversation
e4f1814
to
6b4d645
Compare
Could we implement this without adding a |
6b4d645
to
1a8fc05
Compare
@josevalim currently %{} works in DF.mutate(df, c: %{a: a, b: b}) # works
DF.mutate(df, c: %{a: is_nil(a), b: is_nil(b)}) # works
DF.mutate(df, c: is_nil(%{a: a, b: b})) # fails
** (ArgumentError) expected a series as argument for is_nil, got: %{a: #Explorer.Series<
LazySeries[???]
s64 (column("a"))
>, b: #Explorer.Series<
LazySeries[???]
s64 (column("b"))
>}
(explorer 0.9.0-dev) lib/explorer/series.ex:6127: Explorer.Series.apply_series/3 How to tackle this ? |
I am on my phone, but somewhere in lazy series we handle all literals, we should probably add map handling in there. The code will probably be pretty similar to the one you added to data frame, so we should probably find a way of sharing those as well. |
I took a Quick Look and I was wrong. We only allow casting in specific operations in series.ex. For example, we could begin supporting maps in the comparison operators, if comparison is supported between structs. Outside of that, we most likely won’t support passing maps. There may be an argument we should allow literal (such as integers and maps) on is_nil, but that’s probably not the case today |
There are some convenient use cases of structs - https://docs.pola.rs/user-guide/expressions/structs/#practical-use-cases-of-struct-columns . Should we support passing struct to a series ? These would add value to mutating, filtering without mutating, etc |
The question is: which operations should we support in on? For example, it doesn't make sense to support them on add or multiply. So I'd do operation per operation, at least initially. |
Ok, let me explore more on this question and come back later. I think this PR is complete for now. |
3c20a80
to
49847b9
Compare
49847b9
to
3f96ea1
Compare
💚 💙 💜 💛 ❤️ |
Add
struct
equivalentNote: Hiding original text as it is stale as per #855 (comment)
Original text
Add `struct` expression.