Questions tagged [compare]

The analysis required to assess the differences and similarities between two or more entities.

This tag is used to classify a question as one dealing with the comparison of at least two entities. The essence of questions that are tagged should boil down to one of the following questions:

  1. How do I control when the compiler/interpreter thinks that two entities are equal? How do I control when the compiler/interpreter thinks that two entities are unequal?
  2. How do I control when the compiler/interpreter thinks that one entity is bigger than the other?
  3. How do I control when the compiler/interpreter thinks that one entity is smaller than the other?

Note that in some languages, it is possible to define asymmetric inequalities. That is, cases in which a<b does not mean that b<a. This is why in python, there exist separate functions for __gt__ (greater than) and __lt__ (less than), etc

10212 questions
2
votes
5 answers

check the value from the list against key value from dictionary Python

I have two data sources, one is a list, the other one is a list of dictionaries. My data looks like the following: need_placeholder = ['1200', '1300', '1400'] ad_dict = [{"Name": "A", "ID": "1999"}, {"Name": "B", "ID": "1299"}, {"Name":…
Chique_Code
  • 1,422
  • 3
  • 23
  • 49
2
votes
2 answers

Compare onclick action of two html button using javascript

I have this two HTML Form buttons with an onclick action associated to each one.
nick2k3
  • 1,399
  • 8
  • 18
  • 25
2
votes
2 answers

How to change key value based on comparison of array of objects in jQuery?

I have two arrays in jQuery as below. var arr1 = [{A: "t1"},{A: "t3"}]; var arr2 = [{A: "t1",B:""},{A: "t2",B:""},{A: "t3",B:""},{A: "t4",B:""},{A: "t5",B:""},{A: "t6",B:""}]; var arr3 = []; //Only for output Now, the output in arr3 should…
foodiepanda
  • 128
  • 1
  • 14
2
votes
3 answers

How to compare values in different objects jq

JSON : {"blockHistory":[10, 12, 14, 17], "hashrateHistory":[ {"hr":1,"time":9}, {"hr":2,"time":10}, {"hr":3,"time":11}, {"hr":4,"time":12}, {"hr":5,"time":13}, {"hr":6,"time":14}, {"hr":7,"time":15} ] I want to get hr for every value from…
Thyme
  • 29
  • 4
2
votes
1 answer

How to compare row-wise two different matrices exhaustively in R?

I have two matrices (mat1 and mat2) with the same number of columns (four each) and different number of rows (one matrix has three and the other one, five). I would like to compare every row in one matrix with every row in the other matrix. The…
Carpa
  • 412
  • 4
  • 16
2
votes
5 answers

PHP - Comparing double to a string is weird?

I'm seeing some weird behavior in php when comparing a double to a string and was hoping someone could explain to me what is going on. If I declare $num = 0.333; and then test $num == '0.333', this comes out as true. If I then add 1 to $num and…
Bach
  • 33
  • 2
  • 4
2
votes
2 answers

AppleScript: Don't let the user continue until the value is greater than 0

I am trying to make the user to input the amount of X things, but these things can't be lower than 0, and in the case the user input more than 32 the code should wanrn the user but still allow to continue if chose to. This is the code I have so…
2
votes
1 answer

Search in list of string or a big string, which one is faster?

trying to capture console output and find keyword in that, which approach should be faster? for example: trying to run "ls" command through python and check a keyword is there in the console output 1st Approach having a list of string and then…
Pradip Das
  • 728
  • 1
  • 7
  • 16
2
votes
1 answer

In C#, how do I check for duplicate elements inside of a list, then print the name of the duplicate element?

I'm trying to sort a list alphabetically, then once the list is sorted, print the name of any element in the list which occurred more than once. Most google searches only address comparing separate lists. I know you can compare strings, and that…
jkuehlin
  • 137
  • 8
2
votes
1 answer

Assign Label value if same as given list in dataframe

Here supposed my dataframe is here, When comparing a column in a dataframe with a list that I have, I want to label the rows in that column if they have the same value. for example compare with 'Name' and my 'list'(ex) list = [Y,B] so In 'Name'…
ybin
  • 555
  • 1
  • 3
  • 13
2
votes
2 answers

Best alternative for using typeid operator

I would like to know which way is the best to compare typeids. Or is there any difference between the two: typeid(std::string&) == typeid(std::string{""}) typeid(std::string) == typeid(std::string{""}) As output they are both true, but i would…
Alberto Sinigaglia
  • 12,097
  • 2
  • 20
  • 48
2
votes
0 answers

How to compare hash tables in sql server 2008

I want to compare 2 hash tables in sql server 2008 using query. Whether its possible or not Please Help
Vyasdev Meledath
  • 8,926
  • 20
  • 48
  • 68
2
votes
1 answer

How to write boolean comparsion function in Coq

I'm trying to remove all integers that are greater than 7 from a list as follows filter (fun n => n > 7). However I get the following error The term "n > 7" has type "Prop" while it is expected to have type "bool". I am new to Coq, how can I fix…
adfexxr
  • 21
  • 1
2
votes
0 answers

PowerShell large folder structure compare

I am looking to compare two large folder structures and compare the current state of a folder structure to a known good historical state, and I need the most performant option possible. The folder structure in question is an Autodesk "deployment",…
Gordon
  • 6,257
  • 6
  • 36
  • 89
2
votes
1 answer

Check if one column value is in another column in pandas

I want to compare one column with another column in the same dataframe. Not just between adjacent value but iterating through every value in Col1 and see if it exists in Col2 values. Col1 Col2 exists cat pig true a …
Lilly
  • 910
  • 17
  • 38