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

Aggregates should return null when all values are null #46

Closed
peterewills opened this issue Dec 9, 2020 · 2 comments · Fixed by #47
Closed

Aggregates should return null when all values are null #46

peterewills opened this issue Dec 9, 2020 · 2 comments · Fixed by #47
Labels
enhancement New feature or request

Comments

@peterewills
Copy link

Right now, if I do op.sum(colName) and all the values of colName are null within a group, the aggregated value for that group is 0.0. IMO it would be more sensible to return null in this case.

Example:

dt = aq.from([{ foo: 1, bar: 1 }, { foo: 1, bar: 3 }, { foo: 2, bar: null }])
dt.groupby('foo').derive({bar: op.sum('bar')})
@jheer jheer added the enhancement New feature or request label Dec 9, 2020
@jheer
Copy link
Member

jheer commented Dec 9, 2020

Thanks @peterewills. I've updated sum to match the behavior of the other non-count aggregate functions. Each returns undefined when invoked over empty or null-only data. Fix will be released shortly in v1.2.3.

@peterewills
Copy link
Author

@jheer thanks so much! We're starting to use arquero in our Observable notebooks here at Stitch Fix, and are really appreciating the work you've put into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants