How to filter using an array?

Hey all!

I’m trying to filter data by a column, I have an array of selected values that I want find in the data.

The column is named symbol and using Inputs.select(list, {mutiple: true}) I can get an array of symbols, let’s say for example that list contained ["AAAA", "BBBB", "CCCC"] and the user selected AAAA and BBBB.

How to return data rows that match that array for the colmun symbol?

I have tried to look in Arquero’s documentation but nothing came up for partial selection, maybe I missed something. Closest thing I got was

df.filter(d => d.includes(d["symbol"], ["AAAA"])) but this doesn’t work for
df.filter(d => d.includes(d["symbol"], ["BBBB", "AAAA"]))

Thank you

Hi,

You’re close! You want to check if the selected values from the list include d.symbol. Something like this: df.filter(d => selection.includes(d.symbol))

Hope this helps!

3 Likes

It did, thank you!

1 Like