Questions tagged [unique-values]

This tag is for questions involving values which are only one of its kind; unlike anything else.

173 questions
100
votes
7 answers

Efficient list of unique strings C#

What is the most efficient way to store a list of strings ignoring any duplicates? I was thinking a dictionary may be best inserting strings by writing dict[str] = false; and enumerating through the keys as a list. Is that a good solution?
user34537
33
votes
8 answers

How to get unique value in multidimensional array

I have done a lot of looking around on the overflow, and on google, but none of the results works for my specific case. I have a placeholder array called $holder, values as follows: Array ( [0] => Array ( [id] => 1 [pid]…
MaurerPower
  • 2,046
  • 7
  • 26
  • 48
16
votes
4 answers

How to get unique values in List

I have 2 text files with data. I am reading these files with BufferReader and putting the data of one column per file in a List. I have duplicated data in each one, but I need to have unique data in the first List to confront with the…
Junior Fulcrum
  • 153
  • 1
  • 1
  • 7
10
votes
5 answers

What regular expression can remove duplicate items from a string?

Given a string of identifiers separated by :, is it possible to construct a regular expression to extract the unique identifiers into another string, also separated by :? How is it possible to achieve this using a regular expression? I have tried…
Tom
  • 6,991
  • 13
  • 60
  • 78
9
votes
5 answers

Get unique value of one attribute from array of associative arrays

I have an array like this: $a = array( 0 => array('type' => 'bar', 'image' => 'a.jpg'), 1 => array('type' => 'food', 'image' => 'b.jpg'), 2 => array('type' => 'bar', 'image' => 'c.jpg'), 3 => array('type' => 'default', 'image' =>…
shikhar.ja
  • 457
  • 1
  • 4
  • 11
8
votes
4 answers

Remove columns with same value from a dataframe

I've got a data frame like this one 1 1 1 K 1 K K 2 1 2 K 1 K K 3 8 3 K 1 K K 4 8 2 K 1 K K 1 1 1 K 1 K K 2 1 2 K 1 K K I want to remove all…
user976991
  • 411
  • 1
  • 6
  • 17
8
votes
4 answers

Gathering all the unique values from one column and outputting them in another column..?

I have this form of a spreadsheet: A B C D abc abc abc 1 def ghi jkl 1 mno pqr stu 3 vwx yza bcd 4 mno pqr stu 5 mno pqr stu 5 vwx yza bcd 5 mno pqr stu 1 Where the first 3 columns are just data of type string. The column D has integers which…
PhysLabTsar
  • 256
  • 2
  • 5
  • 11
3
votes
1 answer

MongoDB Compass: How to select Distinct Values of a Field

I have a MongoDB database where each entry has a 'comment' field. I'm using MongoDB Compass to connect to it, and trying to find all unique values of the 'comment' field. I tried the following code in the 'Aggregations' Tab of Compass (see image…
dromalpalli
  • 117
  • 2
  • 10
3
votes
2 answers

Not able to find unique values in excel

I have some data in excel, I want to select unique values based on multiple criteria. The data that I have in excel is Name Medals Year A 2 2017 B 3 2018 C 5 2018 A 1 2016 C 4 2017 B 7 2018 A 1 2017 D 4 2016 I…
Sivakesav
  • 31
  • 8
3
votes
1 answer

Differing maxima in R using by command

I have the following R code: library(ggplot2) data(diamonds) by(diamonds$price, diamonds$cut, summary) by(diamonds$price, diamonds$cut, max) This gives me: diamonds$cut: Fair Min. 1st Qu. Median Mean 3rd Qu. Max. 337 2050 3282 …
Ohumeronen
  • 1,769
  • 2
  • 14
  • 28
3
votes
3 answers

Collapse and count the number of unique value

I am currently working on an application where I have a dataframe that looks like this: Database UserId Hour Date 01 18 01.01.2016 01 18 01.01.2016 01 14 …
Alban Couturier
  • 129
  • 2
  • 8
3
votes
2 answers

C++: how to check, that enum has only unique values

we use VS 2008 there is a big enum, which is populated by many developers this enum has a type __int64 (a Microsoft extension), and I want to make compiler complain about non unique values in enum. if it was a usual enum I would do like this: enum…
Alek86
  • 1,489
  • 3
  • 17
  • 26
2
votes
2 answers

Google Sheets Formula: Show count of a unique value if appears 1, 2, 3 times

I am struggling a bit to find the right formula here and I was hoping someone can help me with this. I have a sheet with a report that shows all meetings from different sales reps for this year so far. As an overview, I want to list how many…
A.Be
  • 73
  • 5
2
votes
1 answer

Count Unique Values with CountIF works in Excel but gives type mismatch error in VBA

So I'm trying to get how many unique categories I have in my data range and I know how to do it in Excel =SUMPRODUCT(1/COUNTIF(général!N2:N229;général!N2:N229)) but when I try to use it via VBA i get a type mismatch error. …
2
votes
1 answer

get unique values from a list op points in c# error

I have a simple class point public class point { private double X; private double Y; public double x { get { return X; } set { X = value; } } public double y { get { return Y; } set { Y =…
1
2 3
11 12