I have a text file that has a long 2D array as follows: The first element of each has numbers between 1 to 7. I want to read information of second element for all and find the maximum and minimum amount for each group between 1 to 7 separately. For example output like this: What is the most efficient way
Tag: min
Find the nearest value to the given one in set
I am trying to find the closest number to 5 in set b. This is my code. b={1,2,45,65,3,2,8} one=5 a=set() for x in b: c=abs(x-one) a.add(c) print(min(a))
Getting the max and min from a dictionary without using max() and min()
I have a dictionary with two values (id and amount): dict={5: [379], 11: [396], 6: [480], 19: [443]} and I want to find the id with the max and min amount from the dictionary without using the max …
Max and Min value for each colum of one Dataframe
Give this dataframe ‘x’: col1 col2 col3 col4 0 5 -2 1 -5 2 -1 9 3 -7 3 5 How I could get a list of pairs with the min and max of each column? The result …