Why does ak.mean and ak.std behave differently? #2726
Unanswered
WWWonderer
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the code below:
The mean works fine while the std gives me error with following stack trace:
This seems very counterintuitive to me as the std is nothing but some operations on mean. What can be done in mean in terms of broadcasting should also be doable in std. Is there a reason this is happening and how to solve this issue? Thanks!
Edit:
I went a bit deeper into the codebase and found this in variance implementation which is used by std (https://github.com/scikit-hep/awkward/blob/main/src/awkward/operations/ak_var.py):
In the implementation of mean (https://github.com/scikit-hep/awkward/blob/main/src/awkward/operations/ak_mean.py#L156) only x is passed into ak_sum:
Maybe this is the cause of the issue? But is there a way to fix it?
Beta Was this translation helpful? Give feedback.
All reactions