# Questions tagged [max]

Maximum value. Largest, biggest, greatest.

**-1**

votes

**1**answer

21 views

### latest date field

First off by means am I a programmer, I didn't any SQL courses and am self taught. All the data that i want pulls just fine, but I have a MAX set on a date field and it is still giving me all the ...

**1**

vote

**2**answers

43 views

### Find Maximum abs. value for each group of row index, Arrange max. values diagonally in matrix, non diagonal values as per indexes,find determinant

I am new to Python.
I want to find the largest values from all the columns for group of same row indexes (i.e. 5 to 130, beignning with 5), and also show its row and column index label in output. ...

**-1**

votes

**1**answer

36 views

### Get last record for each bonus type by X player from table A grouped by an field of table B

As the title says, i want to get the last record of each bonus_id by X player from table "redeemed_bonuses" grouped by name field from table bonuses.
It's my database structure:
Table: bonuses
"...

**2**

votes

**1**answer

44 views

### Why is max() function so much slower when comparing 2 elements vs direct comparison with an if statement?

By running the below code I get for direct comparison with an if statement almost 4x the speed vs using the max function.
I am trying to understand the reason behind this.
comparison : 0.63s, max : ...

**0**

votes

**2**answers

28 views

### Is there a way to set the console window to a fixed max/min value

Currently I'm determining the position of certain words in the console and after entering the Enter key I always place the cursor on the next word, but I have the problem that if I change the size of ...

**0**

votes

**1**answer

26 views

### Why twice the output in the console from code for a maximum (same code for minimum normal)?

Tthe execution of the following code gives twice the result for that part of it that concerns the maximum but only once for that part meant to produce the minimum, as it should; the only difference is ...

**1**

vote

**2**answers

39 views

### Keep the highest single match for each group

I'm struggling to use pandas to filter based on 2 groupby conditions
Let's say I have the below data:
each row represents a comparisons of things (id1, id2) respectively from 2 data sources (src1,...

**0**

votes

**0**answers

19 views

### Find maximum value from an ArrayList

I created an ArrayList function signature to find all the maximum household incomes from year 1984 to 2016. Now I wanted to find the maximum value from that ArrayList.
I tried to use max() but it ...

**1**

vote

**0**answers

26 views

### InfluxDB MAX value as time series

In InfluxDB, I have a time series of which I would like to determine the maximum value. Using the MAX() function does return the maximum, but as a single point consisting of the maximum value and ...

**0**

votes

**1**answer

23 views

### Is O(m+n) the same as (O(max(m,n))?

If I have two variables,say m and n,and my algorithm has time complexity O(m+n),is O(m,n) the same as having O(max(m,n))?If yes,can you explain why?

**-2**

votes

**3**answers

59 views

### is there a way to find the greatest number from random numbers?

i am writing a code to find the max and min number from a python list. if i provide numbers in list it is easy to get output, but i want to get output from random numbers, how to do it.
i have tried ...

**0**

votes

**2**answers

24 views

### Too much Data using DISTINCT MAX

I want to see the last activity each individual handset and the user that used that handset. I have a table UserSessions that stores the last activity of a particular user as well as what handset they ...

**1**

vote

**2**answers

43 views

### Best way to get MAX customer in my SQL code

Per product, I need to know which customer had the greatest quantity of inventory shipped over a period of time. I only want 1 customer per product to return in my results. I know I should be using ...

**0**

votes

**1**answer

25 views

### How to INDEX MATCH based on a MAX value and returning a cell next to the MAX

I have a table with product name, quantity1, quantity2, price. If a product has a Quantity1 value >0 it have a Quantity2 value of 0 and vica versa. I want to write a formula to return the product ...

**1**

vote

**1**answer

38 views

### How to find 2 largest values from group of rows in multiple columns in Python and also show its row and column index at output

I am new to python. I want to find the largest values from all the columns for repetitive row elements (i.e. 5 to 101), and also show its row and column index label in output.The largest values should ...

**0**

votes

**0**answers

53 views

### Checking Value of max( CASE WHEN ) in a where clause - Edit : HAVING CLAUSE

I have this query from wordpress table. I'm building an api outside wordpress with other database. I'm tring to get the products instock only.
So this - max case when - can give two values, instock ...

**0**

votes

**2**answers

31 views

### How can I get row-wise max based on condition of specific column in R dataframe?

I'm trying to get the maximum value BY ROW across several columns (climatic water deficit -- def_59_z_#) depending on how much time has passed (time since fire -- YEAR.DIFF). Here are the conditions:
...

**0**

votes

**0**answers

35 views

### Wrong index when appending maximum values from arrays into another array

I have a problem with the output of this code :
from math import *
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
a1=15.8
a2=18.3
a3=0.714
a4=23.2
def bindingenergy():
...

**0**

votes

**2**answers

21 views

### How to find max of column in 3D array based on condition in another column?

I have an array with 3 columns and need to find the maximum of the first column where the third column is less than some predefined value.
Input, E.g.:
a = [[ 1 2 1], [ 2 3 3], [ 7 10 5], ...

**1**

vote

**1**answer

30 views

### How to find largest absolute value fro repeatitive rows in multiple columns in Python and also show its row and column index

I am new to python. I want to find the largest values from all the columns for repetitive row elements (i.e. 5 to 4100), and also show its row and column index label in output.The largest value should ...

**2**

votes

**1**answer

32 views

### How to find largest absolute value from specific columns for repetitive row elements using Pandas in Python and also display row and column index

I am new to python. I want to find the top 2 largest values from all the columns for repetitive row elements (i.e. 5 to 4100), and also show its respective row and column index label in output.The ...

**1**

vote

**3**answers

77 views

### How to find single largest value from all rows and column array in Python and also show its row and column index

I am new to python. I want to find one largest value from a grid and also show its respective row and column index label in output.The value should be absolute. (Irrespective of + or - sign)
My data ...

**0**

votes

**2**answers

25 views

### Print calculated values with headers after comparison

How can I print the header of values after I compare them?
I have some calculated values stored as per below:
Value1 12
Value2 6
Value3 7
Value4 5
How can I print the max among four values with the ...

**1**

vote

**0**answers

55 views

### Finding and ploting the maxima and minima points of an numpy array

I'm trying to find and plot the exact number and locations of peaks in an numpy array.
I've tried using the argrelextrema function but it's not finding the right points.
import numpy as np
import ...

**0**

votes

**0**answers

15 views

### How do I set two y values with two y axis (min and max), associated with a single x-axis?

I found the answer in this fiddle, but it is not working with my version of plotly or I am using a wrong syntax.
https://codepen.io/mdnasirfardoush/pen/WyMMdg?editors=1010
I simply want to associate ...

**0**

votes

**0**answers

32 views

### How can I find all maximum values and return field or column names with which.max

I am a student and I want to find the maximum value in the row and return the column name(s) in R. Finding the first instance (column name) for the maximum is possible. But, I can not get all of the ...

**-4**

votes

**3**answers

47 views

### Highest value from array with highest index

I need to find most common digit in array of ints, i would also like to have the highest index(number) of them, so if there is input like [11, 22, 33] then it will return 3 instead of 1. How can I ...

**-1**

votes

**1**answer

25 views

### How to obtain two most recent encounter dates?

I have used this expression in Cognos [Encounter Date]=maximum([Encounter Date] for [Patient Account Number]) to obtain the most recent visit. Does anyone know a command for two most recent visits?

**1**

vote

**1**answer

18 views

### LINQ query to get a max value from a nested collection

I have 3 entities - User, UserGroup and Group. User and UserGroup has many-to-many relationship and Group and UserGroup has one-to-many relationship. So on EF side, User object has a UserGroup ...

**0**

votes

**1**answer

62 views

### How can max() sometimes be a lot faster on a sequence of the same length?

I'm asking this question solely to better understand how kotlin sequences work. I thought I had a solid grasp, but I cannot explain what I observed in a short test by what I know, so obviously I have ...

**0**

votes

**2**answers

28 views

### How to make SymPy Max(2,n) be n?

I'm practicing SymPy and find out Max operator can not solve when value is greater than 1.
n = Symbol('n', integer=True, positive=True)
Max(1,n) # this works fine
Max(2,n) # output Max(2, n)
I'...

**0**

votes

**2**answers

37 views

### Max value by ID, date and last x days

Supposed I have a table :
---------------
id | date | value
------------------
1 | Jan 1 | 10
1 | Jan 2 | 12
1 | Jan 3 | 11
2 | Jan 4 | 11
I need to get the max and median value of ...

**-4**

votes

**1**answer

36 views

### Pandas Dataframe: How to find the maximum value of a column and the date in which he value occurs in the date column?

The multi index pandas dataframe is the following:
Full text Likes
date gap time
2018-05-22 -12.750000 04:20:51 ...... 728
...

**-3**

votes

**0**answers

33 views

### How to change maximum value of integer? [duplicate]

EDIT: I believe my question is different from the question marked as duplicate. I'm asking to overwrite the maximum value, not what it is or why. The other question explained what it is, I'm asking ...

**0**

votes

**1**answer

29 views

### Is there a way so that an already defined argument can appear as missing when using optim() function in R?

I am trying to get the Maximum Likelihood Estimators of the log-likelihood of a Gumbel distribution for survival analysis(i say that so that you dont get astranged by the log-likelihood function, i ...

**0**

votes

**1**answer

49 views

### How to perform select group by with max in PowerShell?

I have an object containing the following in PowerShell:
Date Item Total
---- ---- -----
20190505 AAA 2
20190505 BBB 1
20190514 AAA 6
20190514 BBB 1
20190514 CCC 2
20190524 AAA 5
...

**0**

votes

**3**answers

51 views

### How to retrieve a MAX() from a query while keeping the query result?

I want to make a simple bar chart of some statistics in my database. More specifically: it's a family tree, and I want to show the birth frequency per month. I managed to create the SQL query to get a ...

**-1**

votes

**1**answer

47 views

### C++ trying to use max and accumulate function

I am new to C++ and this is my first program that I am trying to write. In the below code I want to simulate a price of an option and calculate its value. I am getting an error for the accumulate ...

**0**

votes

**1**answer

29 views

### Extract only most recent file based on filename

I want to unzip only the most recent file from files that have been updated. Here's my code:
def main():
dest_dir ='C:/Users/PycharmProjects/kpi/flats'
zip_file ='Z:/OUT.zip'
with ...

**-5**

votes

**3**answers

42 views

### Best way to calculate min, max and average input values, without knowing quantity entered? [closed]

I need to add code to find the min, max and avg of the numbers entered.
Is it best to use an arraylist ?
Thank you for the advice. Glad to hear I'll learn about array lists in the future(because ...

**0**

votes

**1**answer

14 views

### find the maximum value of specific rows in a column

I have an excel table like this:
I want to find the maximum value of "story3" (rows 5,9,13 and ....) in the column "shear X". I mean I should write a formula which finds the row of the "story 3s" and ...

**0**

votes

**1**answer

28 views

### Conditionally calculating the difference between max(raster) and each raster layer of raster stack

I have a list of raster stacks named r.lst. I need to calculate the difference between max(r.lst[[i]]) (stacked rasters) and every raster layer of that raster stack. However, I want to do this ...

**0**

votes

**2**answers

76 views

### How to display minimum and maximum values out of a list?

I need to display the minimum and maximum current Prices out of the list but I could only display the number at the end
public StockPrice() {
char startChar ='A';
String tmpSymbol = null;
...

**0**

votes

**1**answer

61 views

### How to return the Value from Column A on the row where the Max of Column B is found in a subquery

I have time series data and I am creating a rolling average over a 90 sample window (15 min). I then want to find the max 15 min window each hour so the data is grouped by Hour. However I want to ...

**0**

votes

**1**answer

26 views

### javax.validation.constraints.@Max not working as request param

Tried to add @Max validation for the sizes request parameter. However, it seems whatever value I put in will be valid.
A simple controller method in a spring boot application.
@GetMapping("/...

**1**

vote

**3**answers

58 views

### Finding Maximum & Minimum in an array using for loops?

Attempting to find the min/max of a randomly generated array in java. My code is working for finding the maximum, however I'm not sure why when I try running it, the minimum is coming up as 0.0 every ...

**1**

vote

**2**answers

45 views

### passing 1 2 23 32 4 returns 4 in max function in python, why?

My codes
def validate():
if len(sys.argv) > 6:
print("No more than 5 arguments please")
exit()
def printArgs():
print("\nthe arguments are:\n")
for arg in sys.argv[1:]...

**0**

votes

**0**answers

13 views

### How can I get the maximum values of each row for specific columns and form a new column with those values?

I have a data.frame with multiple rows and columns. I want to find the maximum values of every row for specific columns and form a new column with those values.

**1**

vote

**3**answers

56 views

### scheme define list as local variable

My target is do define list as local variable in order to get max element from it. My code:
#lang racket
(define (f a b c)
(list (+ (* a a) (* b b) (* c c)) (+ a c))
(define (max-of-list-2 ...

**1**

vote

**1**answer

25 views

### Second max based on Category in SQL

I am trying to find the second max based on two different categories. I can use analtycal function or logic to get this. I have been trying to find this through a logic.
My question is I am trying to ...