max Questions

2

Solved

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...
Bisayas asked 23/5, 2019 at 19:17

10

Solved

How would you find minValue below? I have my own solution but want to see how others would do it. val i1: Option[Int] = ... val i2: Option[Int] = ... val defaultValue: Int = ... val minValue = ? ...
Lubra asked 28/9, 2012 at 12:22

10

Solved

I have a ui.slider and change its min and max values on runtime. But these changes only get reflected in the view, when I set the values afterwards too (which causes it to fire events that are not ...
Bearded asked 13/6, 2011 at 16:16

4

Solved

I am not completely green to Python, but I am interested in learning/keeping good practices while I develop my skills. I want to remove the high and low values from a list of numbers, which I know...
Teamwork asked 13/4, 2011 at 22:56

16

Solved

How do I find all rows in a pandas DataFrame which have the max value for count column, after grouping by ['Sp','Mt'] columns? Example 1: the following DataFrame: Sp Mt Value count 0 MM1 S1 a **3*...
Piperidine asked 29/3, 2013 at 14:48

10

Solved

I've been doing a basic program to find the max, min, median, variance, mode etc. of a vector. Everything went fine until I got to the mode. The way I see it, I should be able to loop through the v...
Submarginal asked 21/2, 2012 at 1:33

3

Solved

There is a json file like this: [ { "createdAt": 1548729542000, "platform": "foo" }, { "createdAt": 1548759398000, "platform": "foo" }, { "createdAt": 1548912360000, "platform": "foo" }, { ...
Offside asked 2/2, 2019 at 3:15

4

Solved

I tried but failed: mysql> select max(1,0); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to ...
Ultraviolet asked 14/10, 2009 at 11:25

7

Solved

I want to create an array which holds all the max()es of a window moving through a given numpy array. I'm sorry if this sounds confusing. I'll give an example. Input: [ 6,4,8,7,1,4,3,5,7,2,4,6,2,1...
Phosphorescent asked 7/4, 2017 at 23:39

3

Solved

In polars I can get the horizontal max (maximum value of a set of columns for reach row) like this: df = pl.DataFrame( { "a": [1, 8, 3], "b": [4, 5, None], } ) df.with_colu...
Tiffany asked 9/2, 2024 at 10:9

15

Solved

I have this: var arr = [0, 21, 22, 7]; What's the best way to return the index of the highest value into another variable?
Horvitz asked 2/7, 2012 at 21:27

16

Solved

In C++, are std::min and std::max preferable over fmin and fmax? For comparing two integers, do they provide basically the same functionality? Do you tend to use one of these sets of functions or d...
Leisaleiser asked 27/10, 2009 at 16:43

2

Solved

I looking for a suitable algorithm that will return the maximum depth of a collection of objects within a hierarchy of collections. I have a root object which may or may not contain a collection of...
Tole asked 9/3, 2023 at 16:57

5

Solved

Is there anything like Collections.max which finds the maximal value in an array for regular arrays (such as an int[]) in the standard Java runtime library?
Coulombe asked 25/12, 2008 at 18:5

6

Solved

The Java Collections.max method takes only a collection of a sortable (Comparable) object. However since the collection is not necessarily sorted, I don't see any reason not to implement the same m...
Morsel asked 14/1, 2009 at 17:38

8

Solved

I'm trying to find an elegant way to find the max value in a two-dimensional array. for example for this array: [0, 0, 1, 0, 0, 1] [0, 1, 0, 2, 0, 0][0, 0, 2, 0, 0, 1][0, 1, 0, 3, 0, 0][0, 0, 0, 0...
Oliverolivera asked 20/11, 2016 at 8:11

2

Solved

In my python code, I import func... from sqlalchemy.sql.expression import func Then, during my code I select data from a database table... select(func.max(MyTable.my_datetime)) ...where my_dateti...
Akins asked 20/3, 2023 at 10:52

3

Solved

I have some code that uses a Boost accumulator to track a mean across a rolling window -- "rolling mean". In addition to the rolling mean, I would like to track the minimum and maximum across this ...
Kinnikinnick asked 9/8, 2013 at 18:10

6

Solved

I have a 2 dimensional NumPy array. I know how to get the maximum values over axes: >>> a = array([[1,2,3],[4,3,1]]) >>> amax(a,axis=0) array([4, 3, 3]) How can I get the indices...
Glazing asked 29/3, 2011 at 7:35

6

Solved

I have a list of dictionaries like so: [{'price': 99, 'barcode': '2342355'}, {'price': 88, 'barcode': '2345566'}] I want to find the min() and max() prices. Now, I can sort this easily enough usin...
Betts asked 16/3, 2011 at 3:56

17

Solved

Where are MIN and MAX defined in C, if at all? What is the best way to implement these, as generically and type safely as possible? (Compiler extensions/builtins for mainstream compilers preferred...
Carbonic asked 9/8, 2010 at 4:49

8

Solved

I want to return the number as long as it falls within a limit, else return the maximum or minimum value of the limit. I can do this with a combination of Math.min and Math.max. public int limit(i...
Peewee asked 29/7, 2013 at 20:23

22

Solved

I'm using Python's max and min functions on lists for a minimax algorithm, and I need the index of the value returned by max() or min(). In other words, I need to know which move produced the max (...
Jinja asked 18/3, 2010 at 23:20

13

Solved

This is the table structure: CREATE TABLE `reports` ( `report_id` int(11) NOT NULL auto_increment, `computer_id` int(11) NOT NULL default '0', `date_entered` datetime NOT NULL default '1970-01-0...
Steading asked 20/10, 2011 at 12:39

6

Solved

To keep it short, I have found a tutorial online and followed to the point: http://www.tizag.com/mysqlTutorial/mysqlmax.php SELECT type, MAX(price) FROM products GROUP BY type My question is: Ho...
Ramey asked 4/3, 2016 at 16:11

© 2022 - 2025 — McMap. All rights reserved.