Stream: helpdesk (published)

Topic: ✔ Sort & Shuffle


view this post on Zulip Timothy (Mar 22 2022 at 10:27):

I'm looking to sort a dataframe by a column, and when the values are equal shuffle them. In small-scale tests using sortperm(column_values, lt = (a, b) -> a < b || (a == b && rand() < 0.5)) seemed to work, but with longer lists of values it seems you can get segfaults (ref: https://github.com/JuliaLang/julia/issues/44698).

Might someone have advice on how I can accomplish this without segfaulting?

view this post on Zulip Timothy (Mar 23 2022 at 01:43):

Ah, it looks like I can use that lt function if I set alg=MergeSort.

view this post on Zulip Notification Bot (Mar 23 2022 at 01:43):

Timothy has marked this topic as resolved.


Last updated: Dec 28 2024 at 04:38 UTC