-
Notifications
You must be signed in to change notification settings - Fork 63
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
Alternative to a fluent API #16
Comments
I don’t think I fully understand what you are trying to accomplish and why you need params to do it. Can you provide a bit more detail about your task, the input, and the desired output? |
Hi @jheer - first thanks for this. It's amazing, I was thinking of building a backend in python to use numpy but this really made prototyping some ideas so much quicker. I made this observable notebook for you to take a peek, perhaps its clearer? I know how to do the JS bits, was just wondering what how to achieve this in Arquero? https://observablehq.com/@dscape/alternative-to-a-fluent-api-16 |
I'm still not entirely sure what transformation logic you have in mind, but here is a guess. staffAq
.unroll({ month: d => op.sequence(0, 12) })
.derive({ monthly: d => op.month(d.start) <= d.month ? d.monthly : 0 })
.params({ names: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] })
.derive({ month: (d, $) => $.names[d.month] })
.groupby('name')
.pivot('month', 'monthly', { sort: false })
.select('name', 'Jan', 'Jul', 'Dec')
.view() The steps involved are:
|
Thank you, this is excellent! |
Hi,
I'm trying to
derive
many keys with differentparams
:However the months can be 3, 6, or 12. So I need to calculate the derive function using a object that looks like
Without a fluent api I can imagine doing something like
Is there a way to achieve this in Arquero? Alternatively I'll have to append the array to the existing Arquero table, do a spread, and rename the columns? Is that the solution that is advisable? This means I would do the calculations outside arquero, which might defeat the point?
The text was updated successfully, but these errors were encountered: