# Filtering dataframe for unique rows with respect one of column

**URL:** <https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185>\
**Category:** New to Julia\
**Tags:** question, dataframes\
**Created:** [July 18, 2024, 1:38pm UTC](https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185 "2024-07-18T13:38:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [July 18, 2024, 1:38pm UTC](https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185/1 "2024-07-18T13:38:07Z")

</div>

Hello i have following DataFrame :

```julia
julia> a = DataFrame(x = [1, 2, 2, 3, 4], b = [3, 4, 5, 6, 7])
5×2 DataFrame
 Row │ x b     
     │ Int64 Int64 
─────┼──────────────
   1 │ 1 3
   2 │ 2 4
   3 │ 2 5
   4 │ 3 6
   5 │ 4 7

```

Now what I want is this : Im not sure how to do such filtering. Initially I thought `unique()` will help but then both rows are not identical so it doesn’t detect it.

```julia
4×2 DataFrame
 Row │ x b     
     │ Int64 Int64 
─────┼──────────────
   1 │ 1 3
   2 │ 2 4
   3 │ 3 6
   4 │ 4 7

```

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 18, 2024, 1:50pm UTC](https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185/2 "2024-07-18T13:50:30Z")

</div>

You mean this?

```julia
julia> unique(a, :x)
4×2 DataFrame
 Row │ x b
     │ Int64 Int64
─────┼──────────────
   1 │ 1 3
   2 │ 2 4
   3 │ 3 6
   4 │ 4 7

```
