-
Notifications
You must be signed in to change notification settings - Fork 26
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
Using transform on floats breaks sorting #60
Comments
Can't really think of an easy solution for this one apart from keeping 2 distinct columns, one for displaying and one for sorting (which you could hide with A solution could be to do some regex search for numeric values and striping out everything else before sorting, but this operation would have to be done on each pair of values being compared which, in addition to being tricky to do correctly) would slow things down quite a bit (or it would need a significant rewrite which will not happen if I'm honest) |
Yes, I see what you mean. I had two thoughts:
|
Ah wait are you talking about the My "solution" above referred to the latter and would operate JavaScript side through the library that handles the grid display, yours seem to suggest the former (i.e. Python side). Regarding your thoughts:
|
Sorry for the confusion -- I am actually referring to the button on the rendered grid. I didn't look at when/how the data is shipped to JS, so I forgot to think about sorting in JS rather than pandas. I'm not interested in sorting once -- as you say, that's not too tricky -- just hoping that if someone sorts on a field that's |
Ok in that case I guess a reasonable feature would be to add a new |
If I use a
transform
dictionary to change the formatting of certain properties (say, according to other local variables) like so:...then it appears all sorting it based on the
str
representation of"MPP std. dev. difference"
instead of thefloat
representation, even though in the actual data frame, the column"MMP std. dev. difference"
hasdtype
offloat64
. In this example, I could just change the column title before I pass the data tomols2grid
, but in other cases, I want to usetransform
to otherwise mutate the string shown to the user yet still retain sorting by originaldtype
. Is this possible?Edit: I think the issue arises from
mols2grid/mols2grid/molgrid.py
Lines 648 to 649 in d156fc9
str
in the above code snippet.A simpler example that would show the same behavior is this:
where just changing the display from
3.14
tox = 3.14
will break sorting.The text was updated successfully, but these errors were encountered: