How do you compare 2 lists and return the difference? (difference function in python does not return what I need)

I am trying to find the difference between 2 lists. Basically, I want to know everything that is in list 1 that is not in list 2. The best way to explain it, is with an example:

List1 = [a, a, b, c, d, e]
List2 = [a, b, c, d]
In this example, I would like a function that would return [a, e]

When I use the difference function in python, it will only return "e" and not that there is an additional "a" that is in list 1. When I simply used XOR between the 2 lists, it also only returned "e." Thanks!

View Replies

Related to : How do you compare 2 lists and return the difference? (difference function in python does not return what I need)

How can I compare two lists in python and return matches
Category : Programming Languages

I want to take two lists and find the values that appear in both.

a = [1, 2, 3, 4, 5]
b = [9, 8, 7, 6, 5]
returnMatches(a, b)

would return [5], for instance.

View Replies

Compare Two Columns and Return difference
Category : Excel
I have two columns of values and I want to compare them and return differing values. So I named the ranges "A" and "B" so if your in B but not in A I want that value in C.
I started with a vlookup but that doesn't seem appropriate to the way I was using it.

View Replies

Compare 2 worksheets and return only the difference
Category : Excel
I have two worksheets in my Excel file.
I have put a snippet of each worksheet along side each other so it's easy to see:
<SCRIPT ******************** src=""></SCRIPT><CENTER><TABLE cellSpacing=0 ce

View Replies

Compare two DataTables and return 3rd with Difference
Category : ASP &

Hello :

I have two DataTables, with Different Columns. Some of the Columns are same between them.

i am looking to do this.
It is also refered to as MINUS and is simply all the rows that are in the First table but not the Second.

These three colums are same between the two tab

View Replies

Compare Two Numbers and Return Difference
Category : Databases
Compare Two Numbers and Return Difference
I need to compare the value of two controls on my form and return the difference between them. Both controls will contain a number in currency format with two decimal places. A third control with the same format settings

View Replies

compare two lists in python and return indices of matched values
Category : Programming Languages

For two lists a and b, how can I get the indices of values that appear in both? For example,

a = [1, 2, 3, 4, 5]
b = [9, 7, 6, 5, 1, 0]
return_indices_of_a(a, b)

would return [0,4], with (a[0],a[4]) = (1,5).

View Replies

Jquery - Compare 2 arrays - return difference
Category : Web Design

What's the fastest / best way to compare two arrays and return the difference? Much like array_diff in PHP. Is there an easy function or am I going to have to create one via each()? or a foreach loop?

View Replies

Compare two batches of text and return difference
Category : Development
Hi, Im trying to figure out a way to compare two versions of the same text file from a database and to highlight the changes when viewing the text? Can anyone help me with this?

View Replies

Compare 2 Columns of alphanumeric data and return the difference
Category : Excel
Hi, I have 2 columns in a spreadsheet. I would like to compare column A values with Column B values and find out what is the difference if any. So whatever values do not appear in column B but are there in column A or vice-versa. For eg
ColumnA ColumnB
1.x.a 2

View Replies

compare data in query to field in table return difference
Category : Access
Hello to all...
Please if anyone can help with this.
Have table "Staff" and table "StaffHrs" which is populated by user entry. Have query "StaffHrs report" to generate report from StaffHrs table.
This is what I'm trying to do: When "StaffHrs

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .