Questions tagged [unique-values]

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

173 questions
0
votes
2 answers

Pandas Dataframe: Find unique value from one column which has the largest number of unique values in another column

I have the following pandas dataframe df = pd.DataFrame([[99, 88, 88, 66, 66, 99, 66, 77, 77, 77, 66, 66, 99, 99], list('DAABBBBABCBDDD'), ['***','**','****','*','***','*','**','***','*','*','****','**','**','****']]).T df.columns =…
Julian
  • 9
  • 3
0
votes
2 answers

Insert unique random number with recursive MySQL

I want to populate a table with unique random numbers without using a procedure. I've tried using this reply to do it but not success. What I'm trying to do is something like this but validating that numbers are not repeated: INSERT into table…
FdelS
  • 90
  • 1
  • 5
0
votes
1 answer

How to overcome unhashable type: 'list' error, when trying to get unique values from a pandas dataframe column in Python

I have a Pandas dataframe with Facebook data collected with Crowdtangle, where I would like to get the unique values of some of the columns. For most of the columns, an expression like this works just fine: df.column_name.unique(). Example: In:…
Nicolai MC
  • 19
  • 1
  • 5
0
votes
2 answers

How to calculate time between values in a table?

thank you for having time to read my question. I have a mysql table that logs ON and OFF actions for a sensor each in a row. Is it posible to calculate time between OFF and ON when a new row is added with value ON? This is my…
0
votes
1 answer

SQL create row_number from multiple string columns

I have in my table 3 string column and I want to create unique column with a row_nubmer. I have tried something like this but didn't get unique values: ROW_NUMBER() OVER(PARTITION BY ([Marker1] + [Marker2] + [Marker3]) ORDER BY ([Marker1] +…
0
votes
2 answers

How to define a unique field in mongoose schema?

My Schema is like below: const schema = new mongoose.Schema({ a: { b: { type: String, unique: true }, c: { type: String } }, aa: { bb: [{ cc: { type: String, unique: true }, dd: { type:…
mehdi parastar
  • 737
  • 4
  • 13
  • 29
0
votes
2 answers

Get the first and last value of a column of dataframe respect another column

I'm a beginner on python and I would like to get the first and last value of the column date always that the mac_address be the same, for example: I've ordered my dataframe by mac_address, date with the next line: df =…
0
votes
1 answer

Incorrect data output with pandas

I have a csv file that looks as follows: start_date,end_date,pollster,sponsor,sample_size,population,party,subject,tracking,text,approve,disapprove,url 2020-02-02,2020-02-04,YouGov,Economist,1500,a,all,Trump,FALSE,Do you approve or disapprove of…
Olaola
  • 29
  • 7
0
votes
1 answer

Comparing values in lists of a dictionary in Python

I'm a beginner learning to use Python and I have a problem with comparing values in dictionary lists. In the example dictionary below, I would like to have a dictionary that is the result of the comparison of the elements of the list in the…
jeje
  • 1
  • 1
0
votes
0 answers

React javascript get value by ID

I've got a question, how to get a value to find it by id? Eg I got something like: "{section,249013: 'some value', section,244242: 'another value'}" and I need to put it into the object const someObject = [ section: { id: 249013, options:…
๖JoJo
  • 55
  • 1
  • 8
0
votes
2 answers

Extract unique string values from a list within a list

So I have a .csv file with a bunch of movie titles, and one of the columns is the listing on Netflix, and it is a list so it has multiple listings, it looks like the spreadsheet below: I have managed to extract the individual columns that I need,…
0
votes
2 answers

JavaScript Objects, how to not have duplicate values

Trying to create a function that does not allow an object to crate a new key if the value of the key has already been used. So the object cannot have name = crystal and favoriteRock = crystal Once value has been declared, no other key within the…
0
votes
0 answers

how to find unique values with matlab in cell array

How do I find unique cells in excel using matlab? i was trying to get all unique strings in some excel field, so baisicly im trying to do somthing like this: [~,~,mainraw] = xlsread(mainfilename,1); unique_expense_types = unique(mainraw(:,2)); it…
Ron Vaisman
  • 169
  • 5
0
votes
1 answer

How to convert values of panda dataframe to columns

I have a dataset given below: weekid type amount 1 A 10 1 B 20 1 C 30 1 D 40 1 F 50 2 A 70 2 E 80 2 B 100 I am trying to convert it to another panda frame based on total…
user3104352
  • 1,100
  • 1
  • 16
  • 34
0
votes
1 answer

Making unique values into duplicates in R

I am working with R and I have a table that look like this... A B C D E F And I need the table to look like this... A A A A A B B B B B C C C C C D D D D D E E E E E F F F F F So,I need the same values 5 times in order to match them with another…
Ajrhjnd
  • 330
  • 1
  • 9