# comparison

## Comparing two Dataframes and creating a third one where certain contions are met

Comparing two Dataframes and creating a third one where certain contions are met Question: I am trying to compare two different dataframe that have the same column names and indexes(not numerical) and I need to obtain a third df with the biggest value for the row with the same column name. Example df1= | | …

Total answers: 1

## Comparing all contents of two files

Comparing all contents of two files Question: I am trying to compare two files. One file has a list of stores. The other list has the same list of stores, except it is missing a few from a filter I had run against it from another script. I would like to compare these two files, …

Total answers: 2

## How to make a comparison of part of an array with one value

How to make a comparison of part of an array with one value Question: if x[3] > y and x[4] > y and x[5] > y and x[6] > y and x[7] > y and x[8] > y: … Do U have a more elegant method to compare it? actually, I have to compare one …

Total answers: 3

## List of numbers have same data but different sum

List of numbers have same data but different sum Question: I have two lists of numbers. After comparing them with zip(), they are same (at least what I know) but there sum is different. You can get the script with list of numbers here as the script is huge, I cannot fix it in this …

Total answers: 1

## Does the preprocessing of one algorithm change the conditions of the experiment?

Does the preprocessing of one algorithm change the conditions of the experiment? Question: As an example, We have two algorithms that utilize the same dataset and the same train and test data: 1 – uses k-NN and returns the accuracy; 2 -applies preprocessing before k-NN and adds a few more things, before returning the accuracy. …

Total answers: 1

## Check to see if two lists have the same value at the same index, if so return the index. If not return -1

Check to see if two lists have the same value at the same index, if so return the index. If not return -1 Question: So basically I am trying to compare two lists to see if they hold the same value at the same index at any point. If they do I return the index, …

Total answers: 3

## How to compare 2 Ordered Dictionaries and create a new Ordered one with differences? (Python 3.7)

How to compare 2 Ordered Dictionaries and create a new Ordered one with differences? (Python 3.7) Question: I’m struggling on how to generate a "Differences" Ordered-Dictionary containing the Different and also New values appearing on a "Modified" Ordered-Dictionary after comparing with a "Reference" Ordered-Dictionary. EXAMPLE: #python from collections import OrderedDict ref_d = OrderedDict() # REFERENCE …

Total answers: 2

## How to compare column in different dataframes for fragment of characters in python

How to compare column in different dataframes for fragment of characters in python Question: I have two dataframes of different size but common columns, with ID numbers as key column. I want to compare the column "names" in both dataframes. But sometimes the "names" does not match because there are upper cases or there are …

Total answers: 1

## Python: comparing numpy array with sub-numpy array without loop

Python: comparing numpy array with sub-numpy array without loop Question: My problem is quite simple but I cannot figure how to solve it without a loop. I have a first numpy array: FullArray = np.array([0,1,2,3,4,5,6,7,8,9]) and a sub array (not necessarily ordered in the same way): Sub array = np.array([8, 3, 5]) I would like …

Total answers: 1

## Comparing nested dictionaries into general dictionary

Comparing nested dictionaries into general dictionary Question: I would like to compare multiple nested dictionaries inside a larger dictionary. Suppose we have the following dictionary: pricesDict = { "supermarket_1": {"apples": 1, "bananas": 2, "melons": 3}, "supermarket_2": {"apples": 1.5, "bananas": 2, "melons": 3}, "supermarket_3": {"apples": 1, "bananas": 2, "melons": 3}, "supermarket_4": {"apples": 1, "bananas": 2.7, "melons": …

Total answers: 2