hello :wave: . Does daft support user defined aggr...
# general
m
hello ๐Ÿ‘‹ . Does daft support user defined aggregation functions? Concretely, i want to compute standard deviation of a column in daft but couldn't find any implemented expression of std
๐ŸŽ‰ 1
to formulate better my questions: 1. Does daft supports std aggregation? 2. If not, is there a way to define a custom aggregation function?
k
Looks like something that shouldn't be too difficult to add! We do not yet have a user defined global aggregation, although if your data fits into one machine, you can do a groupby on a common key and then a map_groups
@Martin Bomio made an issue to track progress on this: https://github.com/Eventual-Inc/Daft/issues/2997
j
I think stddev should totally be on our roadmap though. Whoโ€™s ready to do some math ๐Ÿ˜›
๐Ÿ™Œ 1
Ok @Raunak Bhagat got nerdsniped by the math
๐Ÿ˜‚ 2
Heโ€™s taking care of it haha
๐Ÿ™Œ 2
r
Hey @Martin Bomio, I've taken on this request and almost have everything working. Right now, just waiting on the CI pipeline and some incoming reviews. The PR is opened here https://github.com/Eventual-Inc/Daft/pull/3005 Hopefully this gets merged in ASAP and we unblock you.
๐Ÿ™Œ 1
Hey @Martin Bomio, stddev has been released in the latest version of daft! https://github.com/Eventual-Inc/Daft/releases/tag/v0.3.6 Please let me know if you get the chance to try this feature and if you have any comments or concerns.
๐ŸŽ‰ 1
j
Oh btw @Raunak Bhagat letโ€™s also get an example up on the API docs!
r
Oh hmm, looks like I missed getting an example for expressions. I added examples for dataframes, however. I'll open up a follow-up PR to get that done.
๐Ÿ™Œ 1
m
@Raunak Bhagat thank you for the quick addition! I'll try it out tomorrow!
โค๏ธ 1
r
No worries! If any other features are needed, let me know!
Hey Martin, were you able to try out the stddev feature? How's it holding up? Nothing unexpected, I hope.
m
hey @Raunak Bhagat tried the implementation today and seems to be working for me (at least on some small data, still need to try full scale)
I do have some other functions that been writing as udfs for now to get unblock but that maybe there's already a way to do it natively. For example, we need a way to gather multiple cols into a single col, this will be used for one-hot encoding. We want to go from daft.Dataframe({"colA": [1, 2, 3], "colB": [4, 5, 6]}) to daft.Dataframe({"gathered": [[1, 4], [2, 5], [3, 6]]}) also let me know if you want me to start another thread
r
Sure, if you donโ€™t mind, a new thread would help organize our convo a bit better!