min

Arraylist of objects - smallest value

天涯浪子 提交于 2019-12-14 02:36:13
问题 I have an arraylist of objects, and the objects have "double" values. I need to print out all the objects, and have the object with the highest value printed first, and the object with the lowest value last. I have also tried to use Collections to sort the arraylist and then print, but I can't seem to get it to work. My arraylist is: ArrayList<Transition> transitions = new ArrayList<Transition>(); When i tried to used Collections i used: Object minValue = Collections.min(transitions); Hope

Matlab get number of fullscale Values

狂风中的少年 提交于 2019-12-13 21:03:53
问题 im trying to find out how much samples of an audio track are at the Fullscale Value (max and min Value). The Problem is, im new to matlab and dont know exactly the way to get my results. The Problem is in the second line of my code. Is there a way to get the y value of a signal for every sample ? Or a method to get all the minimum and maximum values ? (findpeaks() dont't work because my signal is an audio file with two channels) unclipped = audioread(fileName); total= 0; values = YV(unclipped

Variable can not be passed into for loop

核能气质少年 提交于 2019-12-13 20:16:09
问题 I have a data frame including sender (id, int), receiver(id, int), communication times (int). A B C 1 5 10 1 6 20 1 7 20 1 8 11 my goal is to find the max communication times and return as 1 6,20 (format as A B,C) Since A1, B6 and A1, B7 both have max communication times 20, I just need to keep the smallest B id number. In map step, I already separated A as key, (B,C) as value. So far I can return the output with A and max C, but I have trouble to return the B value. My code below cannot

replace min value to another in numpy array

好久不见. 提交于 2019-12-13 13:51:39
问题 Lets say we have this array and I want to replace the minimum value with number 50 import numpy as np numbers = np.arange(20) numbers[numbers.min()] = 50 So the output is [50,1,2,3,....20] But now I have problems with this: numbers = np.arange(20).reshape(5,4) numbers[numbers.min(axis=1)]=50 to get [[50,1,2,3],[50,5,6,7],....] However I get this error: IndexError: index 8 is out of bounds for axis 0 with size 5 .... Any ideas for help? 回答1: You need to use numpy.argmin instead of numpy.min :

min/max of collections containing NaN (handling incomparability in ordering)

半城伤御伤魂 提交于 2019-12-13 11:57:26
问题 I just ran into a nasty bug as a result of the following behavior: scala> List(1.0, 2.0, 3.0, Double.NaN).min res1: Double = NaN scala> List(1.0, 2.0, 3.0, Double.NaN).max res2: Double = NaN I understand that for a pairwise comparison it may sometimes be preferable to have max(NaN, 0) = NaN and this is probably the reason why java.lang.Double.compare follows this convention (there seems to be an IEEE standard for that). For a collection however, I really think that this is a strange

numpy.max or max ? Which one is faster?

萝らか妹 提交于 2019-12-13 11:52:19
问题 In python, which one is faster ? numpy.max(), numpy.min() or max(), min() My list/array length varies from 2 to 600. Which one should I use to save some run time ? 回答1: Well from my timings it follows if you already have numpy array a you should use a.max (the source tells it's the same as np.max if a.max available). But if you have built-in list then most of the time takes converting it into np.ndarray => that's why max is better in your timings. In essense: if np.ndarray then a.max , if

Min/Max Values of an Array

流过昼夜 提交于 2019-12-13 11:20:20
问题 I seem to be stuck on what seems to be a pretty basic assignment. I was wondering if anyone could possibly lead me to the right direction and explain to me what is wrong. I have created an array with premade values inserted. Now I have to get the min/max values of this array and display them as well. I keep getting these two errors ".java:126: error: method getMax in class HighArray cannot be applied to given types;" ".java:126: error: method getMin in class HighArray cannot be applied to

How to count min,max in loop (java) [closed]

心已入冬 提交于 2019-12-13 09:59:11
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . I have problem with coding 1 app for toomorow lectures. So, That program ask user for numbers, on typed "100" it's stops, and it shows: -average -min

how to show the max and min from user input?

北城以北 提交于 2019-12-13 08:56:22
问题 Nevermind if xmin == 1: print(ymin) I tried using the max and min but I get a typeerror which is 'int' object not iterable. 回答1: You cannot use min() and max() with integers. It really makes no sense trying to ask a minimum or maximum if computer only has one number to work with. You need to add user inputs into a list like so: ages = [] ages.append(age) After you've done this you can use min() and max() methods: a = min(ages) 来源: https://stackoverflow.com/questions/58676539/how-to-show-the

How to find max and min in an alphanumeric data array in Excel?

旧巷老猫 提交于 2019-12-13 08:39:25
问题 I have the following kind of data A1 B1 C1 D1 II Cm2 447 I Phy Hn 60 II Cm2 457 I Phy Hn 70 II Cm2 448 I Phy Hn 61 II Cm2 458 I Phy Hn 71 II Cm2 449 I Phy Hn 62 II Cm2 459 I Phy Hn 72 II Cm2 450 I Phy Hn 63 II Cm2 460 I Phy Hn 73 II Cm2 451 I Phy Hn 64 II Cm2 461 I Phy Hn 74 II Cm2 452 I Phy Hn 65 II Cm2 462 I Phy Hn 75 II Cm2 453 I Phy Hn 66 II Cm2 463 I PHY ml 76 II Cm2 454 I Phy Hn 67 II Cm2 464 I PHY ml 77 II Cm2 455 I Phy Hn 68 II Cm2 465 I PHY ml 78 II Cm2 456 I Phy Hn 69 II Cm2 466 I