Skip to content

*_by function break when specifying all axes #913

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

Closed
gdementen opened this issue Feb 9, 2021 · 3 comments
Closed

*_by function break when specifying all axes #913

gdementen opened this issue Feb 9, 2021 · 3 comments

Comments

@gdementen
Copy link
Contributor

>>> arr = ndtest(3)
>>> arr.sum_by('a')
3

There is an ugly workaround but that is not user-friendly at all:

>>> arr.expand('b=b0').sum_by('a')
a  a0  a1  a2
    0   1   2
@alixdamman
Copy link
Collaborator

Why would you like to "sum_by" all axes ? It doesn't make any sense to me.

alixdamman added a commit to alixdamman/larray that referenced this issue Feb 18, 2021
…e as if no axis was passed when specifying all axes
@gdementen
Copy link
Contributor Author

Why would you like to "sum_by" all axes ? It doesn't make any sense to me.

It's obviously not on an interactive console but the _by functions are meant to work even when you do not know the axes your array has (you only know it has some required axes but could have more) and this is exactly the case one of our users stumbled into when he wrote some long reporting function which used sum_by, then passed arrays with different axes to it and it worked fine until he passed an array which had only the required axes.

@alixdamman
Copy link
Collaborator

this is exactly the case one of our users stumbled into when he wrote some long reporting function which used sum_by, then passed arrays with different axes to it and it worked fine until he passed an array which had only the required axes.

Now it makes sense to me. Thanks for the explanation.

alixdamman added a commit to alixdamman/larray that referenced this issue Feb 24, 2021
…e as if no axis was passed when specifying all axes
gdementen pushed a commit to gdementen/larray that referenced this issue Nov 30, 2021
…e as if no axis was passed when specifying all axes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants