Skip to content

Plotly Transform Aggretation: median calculation appears wrong #4966

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
mwills opened this issue Jun 30, 2020 · 2 comments · Fixed by #4969
Closed

Plotly Transform Aggretation: median calculation appears wrong #4966

mwills opened this issue Jun 30, 2020 · 2 comments · Fixed by #4969
Labels
bug something broken

Comments

@mwills
Copy link

mwills commented Jun 30, 2020

I have an application that can show the data in box format or aggregate into a scatter. I noticed that some groups were showing different 'median' values.

here is a simple example using the numbers of 6, 28, 33, 37, 49 which is resulting in a median of 37...

See the Pen Plotly.js Transforms median error?

@archmoj
Copy link
Contributor

archmoj commented Jun 30, 2020

@mwills thanks very much for the report and a minimal example.
It appears there is a sorting problem when numbers have different digits!
And if I add 100 to that list I get the correct answer | demo.

@archmoj archmoj added the bug something broken label Jun 30, 2020
@alexcjohnson
Copy link
Collaborator

Heh we’re probably falling into the trap of assuming the default sort function is numeric, but it’s actually string-based. I never did understand that choice...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants