Extract row if column contains text in Julia dataframe

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

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 =~

You could do

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.

1 Like