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
0 answers

How to Compare & synchronize two database schema using PHP Script

I have a development database and a production database. I have done some changes in development database Now I have to update the production database So I want a php/SQL script to compare and sync the schema for both databases. I have research…
Mannu saraswat
  • 1,061
  • 8
  • 15
2
votes
0 answers

Compare-Object returns unexpected results

$test_array = @('one', 'two', 'three') foreach ($entry in $test_array) { Write-Host $entry -BackgroundColor Red $test = Compare-Object -DifferenceObject $entry -ReferenceObject $entry -IncludeEqual $test } I have this code above. What…
David Trevor
  • 794
  • 1
  • 7
  • 22
2
votes
0 answers

Compare: discrepancy in documentation

This is a follow-up to my previous question Under std::lower_bound, for the following the overload template< class ForwardIt, class T, class Compare > ForwardIt lower_bound( ForwardIt first, ForwardIt last, const T& value, Compare comp ); (until…
Vinod
  • 925
  • 8
  • 9
2
votes
0 answers

Regarding binary predicate Compare

My reference is to the binary predicate Compare comp expected in the overload of std::lower_bound etc.: The description reads: The signature of the predicate function should be equivalent to the following: bool pred(const Type1 &a, const Type2…
Vinod
  • 925
  • 8
  • 9
2
votes
2 answers

Compare two files in makefile

I need help with comparing two files in makefile. I need something like this: if [cmp $(FILE1) $(FILE2)] !=0; than echo "OK" else echo "WRONG" fi But I am not sure how exactly to do that, Thanks
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
2
votes
2 answers

Python: Compare two Pandas DataFrames and get indices of differences

I would like to compare two Pandas DataFrames and get the indices of the differences. import numpy as np import pandas as pd rng = pd.date_range('2019-03-04', periods=5) cols = ['A', 'B', 'C', 'D'] df1 = pd.DataFrame(np.arange(20).reshape(5, 4),…
Andi
  • 3,196
  • 2
  • 24
  • 44
2
votes
2 answers

PHP - Comparing time

I'm working on a calendar/planner web app and I need to compare the start and end times of events before I store them in my DB. An event can only have a range of one day and between 8am and midnight. The start time always has to take place before…
Joris Ooms
  • 11,880
  • 17
  • 67
  • 124
2
votes
3 answers

How to compare 2 dataframes columns and add a value to a new dataframe based on the result

I have 2 dataframes with the same length, and I'd like to compare specific columns between them. If the value of the first column in one of the dataframe is bigger - i'd like it to take the value in the second column and assign it to a new…
Bella
  • 937
  • 1
  • 13
  • 25
2
votes
3 answers

compare the items of each list at each index

I have an arrayList of list of String ArrayList> temp = new ArrayList>(); Now, imagine we have 3 list o more like : list 1 : [3,8,15,98] list 2 : [3,4,21,98] list 3 : [5,4,76,90] I would like to print only the smallest…
Bigote
  • 95
  • 7
2
votes
1 answer

pandas groupby and compare multiple columns and rows

I have a csv with over 600 columns and thousands of rows. The original file contains more customers and departments, but this example includes the critical pieces. Note: I derived the Site column from A_Loc1 and B_Loc1 columns, in order to more…
n8-da-gr8
  • 541
  • 6
  • 20
2
votes
4 answers

How do I determine whether the types of two objects are compatible?

I have a generic function that I want to know how to write. List something; public int countItems(List Items) { // Here I would like to compare the type of "Items" with the type of "something" to see if they are compatible. How…
prx
  • 21
  • 2
2
votes
2 answers

How to compare two rows or get the fields which value is not match with the rows that compared?

I'm trying to get the fields which value is not match base on the compared rows. It's hard to explain so I'll put the sample table and its results. Table: orders | seqid | orderId | taskId | field1 | field2 | field3 | field4 …
ace
  • 6,775
  • 7
  • 38
  • 47
2
votes
1 answer

same comparison of different numeric types

I have two variants of several numeric types that I'd like to compare. #include #include using Value = std::variant< uint64_t, int64_t, bool, float, double>; bool compare(Value l, Value r){ return std::visit([](auto v1,auto…
Bomaz
  • 1,871
  • 1
  • 17
  • 22
2
votes
1 answer

Compare numpy arrays of different shapes, row wise, delete same values?

Compare arrays of two different shapes for example: a: ([[1,2], [3,4], [5,6], [7,8], [9,10]]) b: ([[3,4], [5,6]]) c = a -b expected output: c: ([[1,2], [7,8], [9,10]]) So far what I've tried usually results in: operands could not be broadcast…
2
votes
0 answers

Create custom convolution layer and compare two keras layers

I am currently creating a network in keras to perform harmonic/percussive source separation on an audio spectrogram using a median filtering technique (http://dafx10.iem.at/papers/DerryFitzGerald_DAFx10_P15.pdf). Given an input magnitude…
gueushux
  • 21
  • 2