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

**URL:** <https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176>\
**Category:** General Usage\
**Tags:** question, array\
**Created:** [July 13, 2022, 1:48pm UTC](https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176 "2022-07-13T13:48:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [July 13, 2022, 2:01pm UTC](https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176/2 "2022-07-13T14:01:33Z")

</div>

One small package for such things is:

```julia
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]

```

---

_[View the full topic](https://discourse.julialang.org/t/return-duplicate-rows-in-array-with-no-of-times-and-index-of-first-occurence/84176)._
