max

Maximum Value Based on a Condition

别来无恙 提交于 2021-02-05 08:29:51
问题 I have a mock dataset in Excel that I want to print the most recent date, but I want it to be the latest date such that the Type is "referral": Type Date referral 1/6/2017 classroom 1/7/2017 referral 1/8/2017 classroom 1/9/2017 What would that function look like? 回答1: You can use an array formula like this (assuming your columns are A and B): =MAX(IF(A2:A5="referral",B2:B5)) and enter it by pressing Ctrl + Shift + Enter (CTRL+SHIFT+ENTER). When entered by Ctrl + Shift + Enter , Excel will put

Maximum Value Based on a Condition

余生颓废 提交于 2021-02-05 08:27:27
问题 I have a mock dataset in Excel that I want to print the most recent date, but I want it to be the latest date such that the Type is "referral": Type Date referral 1/6/2017 classroom 1/7/2017 referral 1/8/2017 classroom 1/9/2017 What would that function look like? 回答1: You can use an array formula like this (assuming your columns are A and B): =MAX(IF(A2:A5="referral",B2:B5)) and enter it by pressing Ctrl + Shift + Enter (CTRL+SHIFT+ENTER). When entered by Ctrl + Shift + Enter , Excel will put

Get column names for the N Max/Min values per row in Pandas

岁酱吖の 提交于 2021-02-05 07:29:28
问题 I am trying to get, for each individual row, the name of the column with the max/min value up to N-values. Given something like this: a b c d e 1.2 2 0.1 0.8 0.01 2.1 1.1 3.2 4.6 3.4 0.2 1.9 8.8 0.3 1.3 3.3 7.8 0.12 3.2 1.4 I can get the max with idxmax(axis=1) and so on the min with idxmin(axis=1) but this only works for the top-max and bottom-min, not generalizable for N-values. I want to get, if called with N=2: a b c d e Max1 Max2 Min1 Min2 1.2 2.0 0.1 0.8 0.1 b a c e 2.1 1.1 3.2 4.6 3.4

Get column names for the N Max/Min values per row in Pandas

佐手、 提交于 2021-02-05 07:28:28
问题 I am trying to get, for each individual row, the name of the column with the max/min value up to N-values. Given something like this: a b c d e 1.2 2 0.1 0.8 0.01 2.1 1.1 3.2 4.6 3.4 0.2 1.9 8.8 0.3 1.3 3.3 7.8 0.12 3.2 1.4 I can get the max with idxmax(axis=1) and so on the min with idxmin(axis=1) but this only works for the top-max and bottom-min, not generalizable for N-values. I want to get, if called with N=2: a b c d e Max1 Max2 Min1 Min2 1.2 2.0 0.1 0.8 0.1 b a c e 2.1 1.1 3.2 4.6 3.4

sql HAVING max(count()) return zero rows

做~自己de王妃 提交于 2021-02-05 06:48:46
问题 I'm trying to get class rooms with overlap course schedule, my tables: courses: COURSE_ID NAME 11 matematika 22 logika 33 himiya 44 sport 55 algoritmika 66 hedva 77 algebra linearit schedule: ID COURSE_ID ID_ROOM DAY HOUR 1 11 105 Mon 10am 2 11 105 Wen 10am 3 11 105 Thu 10am 4 22 105 Mon 10am 5 22 205 Wen 10am 6 22 105 Thu 10am 7 33 305 Mon 11am 8 33 105 Mon 10am class_room: ID_ROOM LOCATION CAPACITY 105 A 20 205 B 10 305 C 30 My sql is: select class_room.ID_ROOM as crid, class_room.LOCATION,

How can I retrieve all of the maximum values from a list?

℡╲_俬逩灬. 提交于 2021-02-05 06:19:54
问题 I have a class called Employee that implements the Comparable interface. Now I have 5 Employee objects in my list, each of which has its own salary property. I want to find all of the Employee objects that have the max salary. I can get a single object using Employee employee = Collections.max(employeeList); but that only returns a single Employee , while I am trying retrieve an array or list of all of the objects with the same max value. How can I do this? 回答1: To be efficient, you should

How can I retrieve all of the maximum values from a list?

痞子三分冷 提交于 2021-02-05 06:19:05
问题 I have a class called Employee that implements the Comparable interface. Now I have 5 Employee objects in my list, each of which has its own salary property. I want to find all of the Employee objects that have the max salary. I can get a single object using Employee employee = Collections.max(employeeList); but that only returns a single Employee , while I am trying retrieve an array or list of all of the objects with the same max value. How can I do this? 回答1: To be efficient, you should

Selecting the maximum count from a GROUP BY operation

自作多情 提交于 2021-02-04 18:50:11
问题 Forgive my SQL knowledge, but I have a Person table with following data - Id Name ---- ------ 1 a 2 b 3 b 4 c and I want the following result - Name Total ------ ------ b 2 If I use the GROUP BY query - SELECT Name, Total=COUNT(*) FROM Person GROUP BY Name It gives me - Name Total ------ ------ a 1 b 2 c 1 But I want only the one with maximum count. How do I get that? 回答1: If you want ties SELECT top (1) with ties Name, COUNT(*) AS [count] FROM Person GROUP BY Name ORDER BY count(*) DESC 回答2:

Finding the maximum of a curve scipy

我是研究僧i 提交于 2021-02-04 17:49:24
问题 I have fitted curve to a set of data points. I would like to know how to find the maximum point of my curve and then I would like to annotate that point (I don't want to use by largest y value from my data to do this). I cannot exactly write my code but here is the basic layout of my code. import matplotlib.pyplot as plt from scipy.optimize import curve_fit x = [1,2,3,4,5] y = [1,4,16,4,1] def f(x, p1, p2, p3): return p3*(p1/((x-p2)**2 + (p1/2)**2)) p0 = (8, 16, 0.1) # guess perameters plt

Finding the maximum of a curve scipy

最后都变了- 提交于 2021-02-04 17:48:13
问题 I have fitted curve to a set of data points. I would like to know how to find the maximum point of my curve and then I would like to annotate that point (I don't want to use by largest y value from my data to do this). I cannot exactly write my code but here is the basic layout of my code. import matplotlib.pyplot as plt from scipy.optimize import curve_fit x = [1,2,3,4,5] y = [1,4,16,4,1] def f(x, p1, p2, p3): return p3*(p1/((x-p2)**2 + (p1/2)**2)) p0 = (8, 16, 0.1) # guess perameters plt