Occursin with a vector

Hi everyone,

a = [“abc”, “def”,“ghi”]

I have an array a and a column of my dataframe df[:Column1].

Is it possible with the function “occursin” (or another one) to know if the elements of a are into df[:Column1] without making a loop “for i in a” ? Is there a way to broadcast occursin ?

One way:

using DataFrames
df = DataFrame(Col1 = ["abc", "aaf","ghi", "bbc", "baf","bhi"])
a = ["abc", "ghi", "bhi"]
df.Col1 .∈ Ref(a)
2 Likes

Thanks !