Return duplicate rows in array with no of times and index of first occurence

One small package for such things is:

julia> using GroupSlices

julia> A = [1 2; 2 3; 3 4; 1 2.0]  # edited
4×2 Matrix{Float64}:
 1.0  2.0
 2.0  3.0
 3.0  4.0
 1.0  2.0

julia> groupslices(A, dims=1)
4-element Vector{Int64}:
 1
 2
 3
 1

julia> groupinds(ans)
3-element Vector{Vector{Int64}}:
 [1, 4]
 [2]
 [3]

julia> filter(is -> length(is)>1, ans)
1-element Vector{Vector{Int64}}:
 [1, 4]
1 Like