# Extract row if column contains text in Julia dataframe

**URL:** <https://discourse.julialang.org/t/extract-row-if-column-contains-text-in-julia-dataframe/28103>\
**Category:** New to Julia\
**Created:** [August 28, 2019, 12:48pm UTC](https://discourse.julialang.org/t/extract-row-if-column-contains-text-in-julia-dataframe/28103 "2019-08-28T12:48:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [August 28, 2019, 12:48pm UTC](https://discourse.julialang.org/t/extract-row-if-column-contains-text-in-julia-dataframe/28103/1 "2019-08-28T12:48:45Z")

</div>

Hello,  
is it possible to extract a row of the dataframe whose column contain a value?  
for instance, if I have this dataframe:

```julia
col1 col2 col3
a abba gold
b queen gratesthits
c bowie the best of

```

how can I extract the row containing “test”? something like bash’s `=~`

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [August 28, 2019, 1:53pm UTC](https://discourse.julialang.org/t/extract-row-if-column-contains-text-in-julia-dataframe/28103/2 "2019-08-28T13:53:56Z")

</div>

You could do

```julia
findall(r -> any(occursin("test", r[n]) for n ∈ names(r)), eachrow(df))

```

where `names(r)` should be replaced with the columns you want to check.

You can also use `filter` similarly, directly on the dataframe without `eachrow`, if that’s what you’re looking for.
