minimum

find max or min in excel, with conditions

天涯浪子 提交于 2019-12-04 09:57:08
In my spreadsheet I have a column with negative and positive values. I need to get the minimum among all positive values and the maximum among all negative ones. How can I do so? Use array formulas. In the following examples, the values you're checking are in A2:A10 . Maximum negative: =MAX(IF(A2:A10<0,A2:A10)) Press Ctrl + Shift + Enter when entering the formula. Formula will then appear bracketed by {...}. Minimum positive: =MIN(IF(A2:A10>=0,A2:A10)) Also enter as an array formula by pressing Ctrl + Shift + Enter 来源: https://stackoverflow.com/questions/6666057/find-max-or-min-in-excel-with

Get minimum unused value in MySQL column

眉间皱痕 提交于 2019-12-04 09:32:19
I have a table with integer ID column. I would like to get the minimum unused value for this column. The query should find the first hole in table IDs and get the minimum value inside it. I'll try to explain it with some examples. Example 1: no-holes table In this case, I have a table without holes and query should simply get the minimum unused value: should get: 4 |id| |1 | |2 | |3 | Example 2: table with hole on top In this case, we have a hole on top (missing value: 1). The query finds the hole and gets the minimum value inside it: should get 1. |id| |2 | |3 | |4 | Also in this case, we

How to find the minimum value in a numpy matrix?

穿精又带淫゛_ 提交于 2019-12-04 03:08:29
Hey this is a quick and easy question... How would i find the minimum value of this matrix, excluding 0? As in, 8 arr = numpy.array([[ 0., 56., 20., 44.], [ 68., 0., 56., 8.], [ 32., 56., 0., 44.], [ 68., 20., 56., 0.]]) As you're using numpy , you could use arr[arr>0].min() for the case you posted. but if your array could have negative values, then you should use arr[arr != 0].min() 来源: https://stackoverflow.com/questions/11764260/how-to-find-the-minimum-value-in-a-numpy-matrix

List minimum in Python with None?

无人久伴 提交于 2019-12-03 16:12:33
问题 Is there any clever in-built function or something that will return 1 for the min() example below? (I bet there is a solid reason for it not to return anything, but in my particular case I need it to disregard None values really bad!) >>> max([None, 1,2]) 2 >>> min([None, 1,2]) >>> 回答1: None is being returned >>> print min([None, 1,2]) None >>> None < 1 True If you want to return 1 you have to filter the None away: >>> L = [None, 1, 2] >>> min(x for x in L if x is not None) 1 回答2: using a

Maximum value for Float in Java?

空扰寡人 提交于 2019-12-03 14:49:06
问题 The following question indicates that the minimum value of a Double is -Double.MAX_VALUE . Is this also true for Float (i.e., -Float.MAX_VALUE )? 回答1: Yes, -Float.MAX_VALUE is the negative number with largest magnitude. float s are represented the same way as double s, just with half the storage space (and the accompanying loss of precision.) Since signs in IEEE 754 are represented by a single bit, flipping that bit doesn't change the overall magnitude attainable by the remaining bits. 回答2:

Set minimum iPhone OS version for app?

自古美人都是妖i 提交于 2019-12-03 13:20:47
I'm about to publish an app on the app store, and I'm looking to set the minimum OS version as it appears in iTunes as "Requires iPhone OS 3.x or later". 2 questions: 1) Where do I set this in my Xcode project? 2) I'm aware of the UITableViewCell numberOfLines property that is present only in OS > 3.1. If I set my minimum as OS 3.0, will people who have 3.1 be able to see the number of lines properly as I coded? (Obviously people on 3.0 won't be able to) Thanks. fbrereto What you need to do is change the Deployment Target setting in your project. The Deployment Target specifies the minimum OS

R getting the minimum value for each row in a matrix, and returning the row and column name

断了今生、忘了曾经 提交于 2019-12-03 13:16:46
I have a matrix like so: Only in reality it is hundreds or thousands of values. What I need to do is return the minimum value for each row, along with the row/col name. So for row 1 in the example, "BAC", the minimum is 0.92 for BAC/CSCO, so I need to return something like: BAC/CSCO 0.92 And then repeat this for each row in the matrix. Assistance is greatly appreciated. I think apply is the trick, but I can't quite get the right combination. X <- matrix(runif(20), nrow=4) rownames(X) <- paste0("foo", seq(nrow(X))) colnames(X) <- paste0("bar", seq(ncol(X))) result <- t(sapply(seq(nrow(X)),

Fetching Minimum/Maximum for each group in ActiveRecord

我只是一个虾纸丫 提交于 2019-12-03 13:08:03
问题 This is an age-old question where given a table with attributes 'type', 'variety' and 'price', that you fetch the record with the minimum price for each type there is. In SQL, we can do this by: select f.type, f.variety, f.price from ( select type, min(price) as minprice from table group by type ) as x inner join table as f on f.type = x.type and f.price = x.minprice;` We could perhaps imitate this by: minprices = Table.minimum(:price, :group => type) result = [] minprices.each_pair do |t, p|

R return the index of the minimum column for each row

心已入冬 提交于 2019-12-03 12:06:21
I have a data.frame that contains 4 columns (given below). I want to find the index of the minimum column (NOT THE VALUE) for each row. Any idea hiw to achieve that? > d V1 V2 V3 V4 1 0.388116155 0.98999967 0.41548536 0.76093748 2 0.495971331 0.47173142 0.51582728 0.06789924 3 0.436495321 0.48699268 0.21187838 0.54139290 4 0.313514389 0.50265539 0.08054103 0.46019601 5 0.277275961 0.39055360 0.29594162 0.70622532 6 0.264804739 0.86996266 0.85708635 0.61136741 7 0.627344463 0.54277873 0.96769568 0.80399490 8 0.814420492 0.35362949 0.39023446 0.39246250 9 0.517459983 0.65895805 0.93662382 0

I have need the N minimum (index) values in a numpy array

大憨熊 提交于 2019-12-03 10:51:35
Hi I have an array with X amount of values in it I would like to locate the indexs of the ten smallest values. In this link they calculated the maximum effectively, How to get indices of N maximum values in a numpy array? however I cant comment on links yet so I'm having to repost the question. I'm not sure which indices i need to change to achieve the minimum and not the maximum values. This is their code In [1]: import numpy as np In [2]: arr = np.array([1, 3, 2, 4, 5]) In [3]: arr.argsort()[-3:][::-1] Out[3]: array([4, 3, 1]) If you call arr.argsort()[:3] It will give you the indices of the