I've this 2D array of data (let's call the variable arr
) that represents a table with various fields:
[1] [2] [3] [4]
[1],Fruit,Apple,Red,10
[2],Fruit,Apple,Green,20
[3],Berry,Strawberries,Red,5
[4],Tuber,Potato,Yellow,2
In this case I need to filter the arr
variable by column 3 = Red (I don't want to search Red in all the table, just in column 3) obtaining this:
[1] [2] [3] [4]
[1],Fruit,Apple,Red,10
[2],Berry,Strawberries,Red,5
How is it possible to apply the .filter function to a 2D array in order to filter for a single field/column?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…