sort(A, dims=1) mixing rows

julia> slow
4811392×2 Array{Any,2}:
 "Ag"       "Aga"
...
 "zzg"       "z"

when
sort(slow,dims=1)
rows are mixed :confused: very denger ! Intuitively sort refers to the table and not each column separately. Is somthing like sortrows in ver 0.6 ?
only

p=sortperm(slow[:,1])
slow[p,:] 

wokrs correcttly

Julia Version 1.0.1
Commit 0d71392 (2018-09-29 19:05 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core™ i7-2630QM CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)

Paul

Did you read the documentation for sort?

I’m not sure if it’s intuitive that sort should sort the entire row by the first column. To do that, you can use:

sortslices(slow, dims=1)

It sounds like you might be porting Julia 0.6 code to Julia 1.0? You should use Julia 0.7 instead during the transition, since it will tell you how to modify your code:

julia> sortrows(slow)
┌ Warning: `sortrows(A::AbstractMatrix; kws...)` is deprecated, use `sortslices(A, dims=1, kws...)` instead.
...

Once your code runs without deprecation warnings in Julia 0.7, switch to Julia 1.0.

Btw, your sortperm alternative does not produce the same result in case of duplicate entries in the first column (it doesn’t look at other columns to break ties).

Yes, "
Sort a multidimensional array A along the given dimension. See sort! for a description of possible keyword
arguments.
" it is about Array :slight_smile:
please use word "for ecach col separatly "!

Warning: sortrows(A::AbstractMatrix; kws...) is deprecated, use `sortslices(A

0.7 told, but i am on the 1.0.1 because 0.7 has a lot of disadvantages.

Please, prepare the 0.7.1 version analogous to 1.0.1 to make the transition less difficult.
Paul

What are those?

I would still highly advice to use 0.7 during the transition phase, then change to 1.0.1.

I would like that too. But there is a lot of data to readddlm () and it’s very slow at 0.7.
eaddlm() 400 sec. vs 15 sec. on 1.0.1
7.0.1 can be very usefull for users
Paul

P.s.
for sortslices(slow, dims=1) now I am waiting more then 10 minuts! With p=sortperm(slow); slow[p,:] is in few second . ver 1.0.1

You gave it an array. There is even an example

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> A = [4 3; 1 2]
  2×2 Array{Int64,2}:
   4  3
   1  2
  
  julia> sort(A, dims = 1)
  2×2 Array{Int64,2}:
   1  2
   4  3
  
  julia> sort(A, dims = 2)
  2×2 Array{Int64,2}:
   3  4
   1  2
1 Like

True ! But version 0.7.1 analigical to 1.0.1 can be very usufull, Plese consider it , in next version will be meny amendments. For evry 1.0.x > 0.7.x
Paul

That sounds like something you can work around? For example, for the purpose of upgrading your code, could you not run it with a slightly smaller dataset than 5 million entries?

Then complete the transition as quickly as possible with Julia 0.7 (no deprecation warnings), then switch to Julia 1.0.1.

Apparently sortslices can be a bit inefficient, but didn’t that also apply to sortrows in Julia 0.6? Perhaps you should stick with sortperm then, if that works for you. (Just consider if you need to support identical values in the first column.)