Questions tagged [filter]
A program or routine that rejects or accepts data that meets a given criterion. An example would be a filter that removed entries less than a given limit from a set of values. Do NOT use this tag for: Signal or image processing, use [filtering]. Java servlet filters. Use [servlet-filters]. For Bloom filters, use [bloom-filter]. For CSS filters use [css-filters].
filter
2,440
questions
1083
votes
20
answers
2.4m
views
Remove rows with all or some NAs (missing values) in data.frame
I'd like to remove the lines in this data frame that:
a) contain NAs across all columns. Below is my example data frame.
gene hsap mmul mmus rnor cfam
1 ENSG00000208234 0 NA NA ...
58
votes
3
answers
51k
views
How to filter the jqGrid data NOT using the built in search/filter box
I want users to be able to filter grid data without using the intrinsic search box.
I have created two input fields for date (from and to) and now need to tell the grid to adopt this as its filter ...
774
votes
31
answers
883k
views
How to filter a Java Collection (based on predicate)?
I want to filter a java.util.Collection based on a predicate.
448
votes
2
answers
110k
views
Why is `[` better than `subset`?
When I need to filter a data.frame, i.e., extract rows that meet certain conditions, I prefer to use the subset function:
subset(airquality, Month == 8 & Temp > 90)
Rather than the [ function:
...
79
votes
10
answers
105k
views
Filter array of objects based on another array in javascript
Given an array of objects :
people = [
{id: "1", name: "abc", gender: "m", age:"15" },
{id: "2", name: "a", gender: "m", ...
176
votes
14
answers
213k
views
What are the best PHP input sanitizing functions? [duplicate]
I am trying to come up with a function that I can pass all my strings through to sanitize. So that the string that comes out of it will be safe for database insertion. But there are so many filtering ...
1132
votes
20
answers
860k
views
List comprehension vs. lambda + filter
I have a list that I want to filter by an attribute of the items.
Which of the following is preferred (readability, performance, other reasons)?
xs = [x for x in xs if x.attribute == value]
xs = ...
137
votes
3
answers
257k
views
How to filter array in subdocument with MongoDB [duplicate]
I have array in subdocument like this
{
"_id" : ObjectId("512e28984815cbfcb21646a7"),
"list" : [
{
"a" : 1
},
{
"a" : 2
},
{
...
32
votes
9
answers
103k
views
How to filter an array by a condition
I have an array like this:
array("a" => 2, "b" => 4, "c" => 2, "d" => 5, "e" => 6, "f" => 2)
Now I want to filter that array by some condition and only keep the elements where the ...
372
votes
8
answers
346k
views
How to use filter, map, and reduce in Python 3
This is how I am accustomed to filter, map, and reduce working in Python 2:
>>> def f(x):
return x % 2 != 0 and x % 3 != 0
>>> filter(f, range(2, 25))
[5, 7, 11, 13, 17, 19, ...
371
votes
8
answers
410k
views
File input 'accept' attribute - is it useful?
Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <input type="file" ...> tag.
Is this attribute useful as ...
198
votes
6
answers
375k
views
How can I use optional parameters in a T-SQL stored procedure?
I am creating a stored procedure to do a search through a table. I have many different search fields, all of which are optional. Is there a way to create a stored procedure that will handle this? ...
141
votes
8
answers
185k
views
How can I group data with an Angular filter?
I have a list of players which belong to a group each. How can I use a filter to list the users per group?
[{name: 'Gene', team: 'team alpha'},
{name: 'George', team: 'team beta'},
{name: 'Steve', ...
119
votes
8
answers
387k
views
Filtering DataGridView without changing datasource
I'm developing user control in C# Visual Studio 2010 - a kind of "quick find" textbox for filtering datagridview. It should work for 3 types of datagridview datasources: DataTable, DataBinding and ...
516
votes
31
answers
656k
views
Filter object properties by key in ES6
Let's say I have an object:
{
item1: { key: 'sdfd', value:'sdfd' },
item2: { key: 'sdfd', value:'sdfd' },
item3: { key: 'sdfd', value:'sdfd' }
}
I want to create another object by filtering ...