Questions tagged [difference]

This tag may refer to 1) the difference between two numbers (i.e. the difference between 5 and 10 is 5) or 2) the things that two or more particular objects do not share in common.

Use this tag for questions that deal with either of the following two topics:

  1. The difference between two numbers.
  2. What two or more particular objects do not share in common.

Related tags:

1970 questions
7
votes
2 answers

Python: What's the difference between set.difference and set.difference_update?

s.difference(t) returns a new set with no elements in t. s.difference_update(t) returns an updated set with no elements in t. What's the difference between these two set methods? Because the difference_update updates set s, what precautions should…
user1015266
7
votes
2 answers

Bounding Box vs. Rectangle

What is the difference between a Bounding Box and a Rectangle? This question is specifically about Unity 3D's Bounds and Rect classes, but I am moreso interested in a general answer. Specifically: Which is better on performance? Is a Bounding Box…
Evorlor
  • 7,263
  • 17
  • 70
  • 141
7
votes
1 answer

difference between MediaPlayer.create and setDataSource implementation

I'm using several media player objects to loop some tracks and I want to know that is the difference between using the MediaPlayer.create(resId) versus manually programming the different states, using setDataSource(FileDescriptor) ect.. I'm still…
7
votes
1 answer

What is the difference between "receive" and "deliver" in a distributed multicast?

What is the difference between a process receiving a message and a process delivering a message, in the context of a multicast?
Zack
  • 13,454
  • 24
  • 75
  • 113
6
votes
4 answers

Find the difference between strings for each two rows of pandas data.frame

I am new in python, and I am struggling with this for some time. I have a file that looks like this: name seq 1 a1 bbb 2 a2 bbc 3 b1 fff 4 b2 fff 5 c1 aaa 6 c2 acg where name is the name of the string and…
LDT
  • 2,856
  • 2
  • 15
  • 32
6
votes
2 answers

Get a new dataframe with difference of every two rows in Pandas

I have a dataframe in Pandas like the above: A B C 0 1 10 43 1 2 12 34 2 1 9 57 3 2 7 47 4 1 6 30 5 2 10 31 What I would like to do is to calculate the differences of every two rows according to column A…
tzoukritzou
  • 337
  • 1
  • 4
  • 16
6
votes
3 answers

Mean absolute difference of two numpy arrays

I have two one-dimensional NumPy arrays X and Y. I need to calculate the mean absolute difference between each element of X and each element of Y. The naive way is to use a nested for loop: import numpy as np np.random.seed(1) X =…
DYZ
  • 55,249
  • 10
  • 64
  • 93
6
votes
1 answer

Difference to group mean in a pandas data frame?

Lets's assume I count how many oranges (Orange) and apples (Apple) people (id) eat in a certain time period. I also know if they are young or old (group). The pandas dataframe would maybe look like this: df = pd.DataFrame({'id': ['1','2','3','7'], …
Rachel
  • 1,937
  • 7
  • 31
  • 58
6
votes
3 answers

Take column-wise differences across a data.table

How can I use data.table syntax to produce a data.table where each column contains the differences between the column of the original data.table and the next column? Example: I have a data.table where each row is a group, and each column is…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
6
votes
1 answer

Vectorized calculation of a column's value based on a previous value of the same column?

I have a pandas dataframe with two columns A,B as below. I want a vectorized solution for creating a new column C where C[i] = C[i-1] - A[i] + B[i]. df = pd.DataFrame(data={'A': [10, 2, 3, 4, 5, 6], 'B': [0, 1, 2, 3, 4, 5]}) >>> df A B 0 …
dimyG
  • 687
  • 9
  • 19
6
votes
1 answer

C#: What's the difference between an "Obsolete" function and "Deprecated" function?

C# has attribute called "Obsolete" to indicate a function should no longer be used. While in .net API specifications, when a class/function is out-dated, we say this is "deprecated". So I wonder about the differences between "Obsolete" and…
vik santata
  • 2,989
  • 8
  • 30
  • 52
6
votes
3 answers

Find the exact difference between two (Joda Time) DateTime objects in java

I am given two dates (one of which is the present) and need to find the difference between the two. My code is giving me bad output (sometimes even negative). I have tried using the Months, Days, Seconds, Hours, and Years classes and appropriate…
Zach
  • 447
  • 6
  • 16
6
votes
3 answers

How do I query a set that doesn't contain any members from another set in MySQL?

I'd like to return a list of students who have taken classes in one department but not in another. Here's my query and its result is coming up blank for some reason. SELECT * FROM student JOIN transcript ON student.id = transcript.studID …
Justin T.
  • 149
  • 2
  • 9
6
votes
3 answers

Calculate difference between 'times' rows in DataFrame Pandas

My DataFrame is in the Form: TimeWeek TimeSat TimeHoli 0 6:40:00 8:00:00 8:00:00 1 6:45:00 8:05:00 8:05:00 2 6:50:00 8:09:00 8:10:00 3 6:55:00 8:11:00 8:14:00 4 6:58:00 8:13:00 8:17:00 5 …
Pragnya Srinivasan
  • 533
  • 1
  • 6
  • 12
6
votes
1 answer

Find X-value position of a label inside a view in Swift

I want to calculate the distance between x-value of two squares positioned in a view. I did not work because in the frame there is also the y-value and do not know how to select only one. how can I add the x-values from the position of the…
Antonio Viscomi
  • 227
  • 2
  • 5
  • 15