Use this tag for questions related to Distinct Values, i.e. values that are distinct/unique from the values in a collection.
Questions tagged [distinct-values]
632 questions
16
votes
4 answers
java 8 how to get distinct list on more than one property
How can one get the distinct (distinct based on two property) list from a list of objects.
for example let there are list of objects with property name and price.
Now how can I get a list with distinct name or price.
suppose
list l1 =…

rcipher222
- 369
- 2
- 4
- 15
15
votes
3 answers
How to efficiently compute a rolling unique count in a pandas time series?
I have a time series of people visiting a building. Each person has a unique ID. For every record in the time series, I want to know the number of unique people visiting the building in the last 365 days (i.e. a rolling unique count with a window of…

Samuel Harrold
- 331
- 1
- 3
- 12
15
votes
5 answers
Converting lodash _.uniqBy() to native javascript
Here in this snippet i am stuck as in _.uniqBy(array,iteratee),this
iteratee can be a function or a string at the same time
Where to put the condition to check uniqness on the property because itratee function can be anything
var sourceArray =…

Gyanesh Gouraw
- 1,991
- 4
- 23
- 31
14
votes
4 answers
Getting a distinct value across 2 union sql server tables
I'm trying to get all distinct values across 2 tables using a union.
The idea is to get a count of all unique values in the columnA column without repeats so that I can get a summation of all columns that contain a unique columnA.
This is what I…

rockit
- 3,708
- 7
- 26
- 36
13
votes
5 answers
How to create a HashSet> with distinct elements?
I have a HashSet that contains multiple lists of integers - i.e. HashSet
- >
In order to maintain uniqueness I am currently having to do two things:
1. Manually loop though existing lists, looking for duplicates using SequenceEquals.
2.…

Preets
- 6,792
- 12
- 37
- 38
13
votes
5 answers
get distinct elements in an array by object property
I have an array of object.
I want to get distinct elements in this array by comparing objects based on its name property
class Item {
var name: String
init(name: String) {
self.name = name
}
}
let items = [Item(name:"1"), Item(name:"2"),…

Hashem Aboonajmi
- 13,077
- 8
- 66
- 75
12
votes
3 answers
distinctUntilChanged set initial value
For rxjs, can I provide an initial value when using distinctUntilChanged? It seems that the equals check is skipped entirely when no previous value was received. I'd like to not emit anything when the first value it receives is the initial…

Didii
- 1,194
- 12
- 36
10
votes
4 answers
How do I pluck a distinct column value from an associated model in a polymorphic association?
If I have a polymorphic association between 3 models as:
Comment
belongs_to :book, :class_name => 'Book', :foreign_key => 'ref_id', conditions: "comments.ref_type = 'Book'"
belongs_to :article, :class_name => 'Article', :foreign_key => 'ref_id',…

user3075906
- 725
- 1
- 8
- 19
10
votes
5 answers
C# Array, How to make data in an array distinct from each other?
C# Array, How to make data in an array distinct from each other?
For example
string[] a = {"a","b","a","c","b","b","c","a"};
how to get
string[]b = {"a","b","c"}

Prince OfThief
- 6,323
- 14
- 40
- 53
10
votes
1 answer
Python plotting error bars with different values above and below the point
Warning: I'm very new to using python.
I'm trying to graph data using error bars but my data has different values for the error above and below the bar, i.e. 2+.75,2-.32.
import numpy as np
import matplotlib.pyplot as plt
# example data
x =…

Rima
- 299
- 2
- 4
- 10
10
votes
2 answers
Use of Distinct with list of custom objects
How can I make the Distinct() method work with a list of custom object (Href in this case), here is what the current object looks like:
public class Href : IComparable, IComparer
{
public Uri URL { get; set; }
public UrlType URLType {…

Pierluc SS
- 3,138
- 7
- 31
- 44
9
votes
5 answers
coldfusion distinct list
I was wondering if there was an easy way to enforce distinct values in a coldfusion list or array.
Thanks

Timothy Ruhle
- 7,387
- 10
- 41
- 67
9
votes
2 answers
How to add distinct values in a multivalue field in solr
I have a multivalue field called category(which is also a store field) in which i need to add only distinct values
value1
value2
If I do a update as follows

Jagadesh
- 6,489
- 8
- 29
- 30
8
votes
3 answers
FormControl.detectchanges - why use distinctUntilChanged?
Reading How to use RxJs distinctUntilChanged? and this, it seems that distinctUntilChanged alters the output stream to only provide distinct contiguous values.
I take that to mean that if the same value arrives in immediate succession, you are…

rmcsharry
- 5,363
- 6
- 65
- 108
8
votes
2 answers
C# MongoDB Distinct Query Syntax
I am trying to get the distinct values from a field in MongoDB. I am having real trouble with the Syntax. Using mongoshell it's relatively easy to do, this is the query I run:
db.cmstest.distinct("categories")
This query returns an array of…

Yiannis P.
- 141
- 1
- 2
- 15