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
1 answer

Comparing DataFrame columns with another list and change

Good Day, I have a Pandas DataFrame with a column 'Cityname' and another list of 'BigCities' For each row in the column 'Cityname' I would like to exchange the Cityname when the city is in the list of 'BigCities' to 1 or if not 0. Can anyone help…
2
votes
2 answers

Compare decimal numbers in an alphanumeric value without preg_replace - PHP

Is it possible to compare decimal values for a value that also contains alphanumeric characters without using preg_replace or stripping out the non-numeric values? For instance comparing these 2 decimal values only ( ignoring any letters) with a…
Wyck
  • 2,023
  • 4
  • 28
  • 34
2
votes
2 answers

How to compare if a string is of less value than other string flutter

I need help to compare 2 strings that i have and i want to check if one of them has less value than the other so i can throw an alert message. My code is as followed if (dateEntered <= date) { print("DateEntered wrong $dateEntered"); } The error…
André Sousa
  • 187
  • 4
  • 17
2
votes
6 answers

Replace XML self-closing tag with empty one

I have to compare XML data. There are two sources- Web Service XML files I don't see any easy way to transform them in same classes and use equals method. The classes that work with Web Services are auto generated and WSDL isn't simple at all. So…
StKiller
  • 7,631
  • 10
  • 43
  • 56
2
votes
1 answer

Compare two rows in a data frame after groupby and perform operations

I have two different csv files, I have merged them into a single data frame and grouped according to the 'class_name' column. The group by works as intended but I dont know how to perform the operation by comparing the groups against one other. …
python_user
  • 5,375
  • 2
  • 13
  • 32
2
votes
4 answers

compare two array and unique value count?

function commonElement(array1, array2) { var count = 0; for (var i = 0; i < array1.length; i++) { for (var j = 0; j < array2.length; j++) { if (array1[i] === array2[j]) { count++; } } } return…
Arvind kumar
  • 87
  • 2
  • 8
2
votes
2 answers

To count how many times one row is equal to a value

To count how many times one row is equal to a value I have a df here: df <- data.frame('v1'=c(1,2,3,4,5), 'v2'=c(1,2,1,1,2), 'v3'=c(NA,2,1,4,'1'), 'v4'=c(1,2,3,NaN,5), …
sylvia
  • 197
  • 1
  • 8
2
votes
1 answer

PHP get file line by line and compare to string

I have a file which is basically a list of names in that format: name.lastname name.lastname name.lastname myname.mylastname name.lastname and I want to check whether a string I have is equal to one of the names (with the dot). Thats what I tried…
2
votes
2 answers

How can I trigger PHP if a MySQL gets a new highest ID?

Im trying to make my Webpage do an action (in this case play a sound) on the event of the highest ID (auto_increment) in my SQL table increasing, which happens when a new user is registered. E.g. : 3 users registered, highest ID = 3. When a new user…
2
votes
2 answers

Powershell check if variable in CSV file

I have a PS script, which loops through file folders and archive some of them: $CSV = import-csv -path C:\folder\Builds\ApplicationsMappingNew.csv $Application = $CSV.Application $GetAppPath = Get-ChildItem -Path…
Vasyl Stepulo
  • 1,493
  • 1
  • 23
  • 43
2
votes
1 answer

Find Diff between two lists of different types

I want to get the difference between two large array of different types in C#. Performance and optimization is an important point because I have to compare large arrays of elements. I must be able to get the missing elements from one list in…
YZahringer
  • 128
  • 1
  • 7
2
votes
4 answers

How to create an error function comparing two matrices?

I have two matrices in MATLAB. Each one is filled with 1 and 0 at different positions. I want to compare each element: If there is a 1 match, I want it to record as True Positive. If there is a 0 match, I want it to record as True Negative. If one…
user1234
  • 111
  • 9
2
votes
2 answers

How to compare two strings alphabetically in Clojure?

If I had one string that was String a = "Apple" and another that was String "b" = "Banana" how would I be able to compare the two and get something like (b > a) evaluates to true in Clojure?
Richard Desouza
  • 249
  • 4
  • 13
2
votes
1 answer

Comparing the contents of two JS arrays

Trying to compare to arrays in JavaScript with the following approach. return stack1.forEach((v, i) => v === stack2[i]); I want to get it working but it is returning undefined instead of true or false if the arrays are the same. Here is the full…
mangokitty
  • 1,759
  • 3
  • 12
  • 17
2
votes
3 answers

Compare 2 arrays to match 2 keys

Need to match 2 keys in 2 multidimensional arrays and return matches from the first array if found. array1 => $arr[1] = array('fruit' => 'apple', 'ver' => '1', 'color' => 'blue', 'name' =>'joe'); $arr[2] = array('fruit' => 'peach', 'ver' => '2',…
Wyck
  • 2,023
  • 4
  • 28
  • 34