Skip to main content

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].

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 ...
Benoit B.'s user avatar
  • 12k
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 ...
Jimbo's user avatar
  • 22.8k
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.
Kevin Wong's user avatar
  • 14.8k
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: ...
flodel's user avatar
  • 88.7k
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", ...
ios_star's user avatar
  • 801
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 ...
Lauren's user avatar
  • 1,777
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 = ...
Agos's user avatar
  • 19.1k
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 }, { ...
chenka's user avatar
  • 1,473
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 ...
menardmam's user avatar
  • 9,946
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, ...
Dick Lucas's user avatar
  • 12.6k
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 ...
Darren Oster's user avatar
  • 9,186
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? ...
Corey Burnett's user avatar
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', ...
Benny Bottema's user avatar
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 ...
mj82's user avatar
  • 5,233
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 ...
29er's user avatar
  • 8,906

15 30 50 per page
1
2 3 4 5
163